Character conversion failing (DLL)
Hello,
I currently have a project that reads a Dynamic Link Library from a HTTP stream into a string (yes it can be done differently but for this project it can't).
The string needs to be converted back to a byte array (which contains the DLL), the problem is the encoding.
I've tried unicode, default, ansi code page ... not sure but they all mess up. Here's a an example to show what I mean;
Original file:
http://img545.imageshack.us/img545/1621/origm.png
Downloaded string converted to byte array then written to file (debug):
http://img811.imageshack.us/img811/8463/conversiont.png
So the problem is clearly the encoding (getbytes), does anyone have an idea how I can write the contents of my string DIRECTLY to a byte array without encoding?
Thanks.
Re: Character conversion failing (DLL)
Quote:
I currently have a project that reads a Dynamic Link Library from a HTTP stream into a string
:confused:
Why can't you just read the stream as binary in the first place? The logic of getting a string and then converting it escapes me.
Re: Character conversion failing (DLL)
The stream returns a base64 encoded string which has to be decoded first (returning a raw file seemed rather unsafe).
The decoded result would contain the actual file which would then need to be converted to a byte array again.
Re: Character conversion failing (DLL)
Well now I'm really confused. Convert.FromBase64String(s) returns a byte array directly.