RonQ Posted December 14, 2003 Posted December 14, 2003 Hello to everyone!! I'm new to this forum and is my first day with .NET... I'm making an aplication to read a file, it's a binary file with some text is spanish, so it has some tildes and ñ. The file is "wrong encoded" it is done with the "new" windows ASCII code.. I'll try to explain. The ASCII code for "ú" is 163, for "é" 130, etc... but in the windows Char Map the code for ú is 250 and for é is 233, the file is encoded this way with this annoying codepage. I opened the file as a FileStream and use a BinaryReader object to read it. Here is the problem, I want to convert those chars to their real value, I think it can be done with System.Text.Encoding.ASCII.GetChars but instead of ascii I get a "?". Anyone can help me with this?? Here i will show you what i have tested: 'The string is "aécX" 'With this Temp=r.ReadChars(3) 'I get Temp = "acX" 'With this Temp=Encoding.ASCII.GetChars(r.ReadBytes(3)) 'I get Temp = "a?c" 'I want to get Temp = "aéc" -- Bye, Ronq. ;) Quote
HJB417 Posted December 14, 2003 Posted December 14, 2003 If you know the codepage, I would use this . ASCII will only display properly up until 127. Quote
RonQ Posted December 14, 2003 Author Posted December 14, 2003 How can i get the code page?? it isn't in the file im using, and also i think is a standart windows codepage, because for example the nfo files that uses the "bad boys", can't be read as well. Quote
HJB417 Posted December 14, 2003 Posted December 14, 2003 (edited) can you post the nfo file? Did you try using the other methods like Encoding.Unicode, Encoding.UTF7 or Encoding.UTF8? Edited December 14, 2003 by HJB417 Quote
RonQ Posted December 14, 2003 Author Posted December 14, 2003 It isn't an NFO file is a dat file from a palm program, it isn't unicode. I think it is this encoding "Windows operating system (windows-1252)", im going to try this. Any more help is welcome. Bye, Ronq. Quote
RonQ Posted December 14, 2003 Author Posted December 14, 2003 It was easyer than i tought i read the entire encoding namespace help to know that the Default encoding would work fine. 'The string is "aécX" 'With this Temp=Encoding.Default.GetChars(r.ReadBytes(3)) 'I get Temp = "aéc" Thanks, to HJB417 for your help! bye, Ronq. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.