Click here to Skip to main content
15,922,894 members
Home / Discussions / C#
   

C#

 
GeneralRe: Hidden forms Pin
solidstore17-May-03 7:50
solidstore17-May-03 7:50 
GeneralRe: Hidden forms Pin
Anonymous26-May-03 3:04
Anonymous26-May-03 3:04 
GeneralGetting pointer to DLL loaded by other program Pin
curiousgal15-May-03 4:28
curiousgal15-May-03 4:28 
GeneralRe: Getting pointer to DLL loaded by other program Pin
James T. Johnson16-May-03 4:25
James T. Johnson16-May-03 4:25 
GeneralSavedialog with serlization.. Pin
tuan_tomy15-May-03 2:25
tuan_tomy15-May-03 2:25 
GeneralCOM interop and BSTR Pin
dshield15-May-03 1:44
dshield15-May-03 1:44 
GeneralRe: COM interop and BSTR Pin
Ranjan Banerji15-May-03 3:16
Ranjan Banerji15-May-03 3:16 
GeneralRe: COM interop and BSTR Pin
dshield15-May-03 4:37
dshield15-May-03 4:37 
The COM object creates the PDF file on the fly. It's a third party control, so there isn't too much we can do about it.

I think my example of loading and manipulating a PDF file isn't the best example, because it doesn't really simulate the problem.

However, just out of curiousity, is there anything wrong with the following code:
<br />
// Assume that pdfFile is a FileSteam object that has opened a pdf file,<br />
// length is an int initialized to the size of the file, and that pdfBytes<br />
// is a byte array of size length.<br />
pdfFile.Read(pdfBytes, 0, length)<br />
<br />
// Convert the pdfBytes array to a string<br />
string pdfString = Encoding.UTF8.GetString(pdfBytes);<br />
<br />
// Convert the string to a new byte array<br />
string pdfBytes2 = Encoding.Unicode.GetBytes(pdfString);<br />


At this point, pdfBytes and pdfBytes2 should be the same, correct? This is not the behavior I'm seeing. I'm new to C#, and probably have made a very obvious mistake, but I would really appreciate someone pointing it out to me.


They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.
--Benjamin Franklin, 1759
GeneralRe: COM interop and BSTR Pin
Ranjan Banerji15-May-03 6:28
Ranjan Banerji15-May-03 6:28 
GeneralRe: COM interop and BSTR Pin
Richard Deeming15-May-03 8:17
mveRichard Deeming15-May-03 8:17 
GeneralAll better now Pin
dshield15-May-03 9:02
dshield15-May-03 9:02 
GeneralRe: All better now Pin
Ranjan Banerji15-May-03 10:20
Ranjan Banerji15-May-03 10:20 
GeneralJava class to C#: inheritance problem Pin
cabo15-May-03 0:51
cabo15-May-03 0:51 
GeneralRe: Java class to C#: inheritance problem Pin
Philip Fitzsimons15-May-03 3:08
Philip Fitzsimons15-May-03 3:08 
GeneralRe: Java class to C#: inheritance problem Pin
cabo15-May-03 5:32
cabo15-May-03 5:32 
GeneralRe: Java class to C#: inheritance problem Pin
Richard Deeming15-May-03 8:23
mveRichard Deeming15-May-03 8:23 
GeneralRe: Java class to C#: inheritance problem Pin
Philip Fitzsimons16-May-03 2:39
Philip Fitzsimons16-May-03 2:39 
GeneralRe: Java class to C#: inheritance problem Pin
Richard Deeming15-May-03 8:21
mveRichard Deeming15-May-03 8:21 
GeneralRe: Java class to C#: inheritance problem Pin
cabo15-May-03 9:32
cabo15-May-03 9:32 
Generalreqaurding rtf boxes Pin
jtmtv1814-May-03 22:57
jtmtv1814-May-03 22:57 
GeneralRe: reqaurding rtf boxes Pin
KingTermite15-May-03 3:35
KingTermite15-May-03 3:35 
GeneralRe: reqaurding rtf boxes Pin
jtmtv1815-May-03 10:11
jtmtv1815-May-03 10:11 
GeneralRe: reqaurding rtf boxes Pin
KingTermite16-May-03 2:41
KingTermite16-May-03 2:41 
GeneralRe: reqaurding rtf boxes Pin
jtmtv1816-May-03 8:19
jtmtv1816-May-03 8:19 
GeneralRe: reqaurding rtf boxes Pin
KingTermite16-May-03 12:59
KingTermite16-May-03 12:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.