|
-
Apr 23rd, 2013, 06:40 AM
#1
Thread Starter
New Member
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:

Downloaded string converted to byte array then written to file (debug):

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.
-
Apr 23rd, 2013, 11:53 AM
#2
Re: Character conversion failing (DLL)
I currently have a project that reads a Dynamic Link Library from a HTTP stream into a string

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.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Apr 23rd, 2013, 12:33 PM
#3
Thread Starter
New Member
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.
Last edited by KaBooM2013; Apr 23rd, 2013 at 12:53 PM.
-
Apr 23rd, 2013, 02:45 PM
#4
Re: Character conversion failing (DLL)
Well now I'm really confused. Convert.FromBase64String(s) returns a byte array directly.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|