Convert string

RonQ

Freshman
Joined
Dec 11, 2003
Messages
28
Location
Argentina
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:
Visual Basic:
'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. ;)
 
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.
 
can you post the nfo file?
Did you try using the other methods like Encoding.Unicode, Encoding.UTF7 or Encoding.UTF8?
 
Last edited:
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.
 
It was easyer than i tought i read the entire encoding namespace help to know that the Default encoding would work fine.

Visual Basic:
'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.
 
Back
Top