Reading a not UTF-8 encoding file

  • Thread starter Thread starter leticia larrosa
  • Start date Start date
L

leticia larrosa

Hi,

I try to read a file that have 8 bit character, but contain some
character
whose code is more than 128 (spanish character).

When I read this file using ASCII (Dim oRead As StreamReader = New
StreamReader("C:\...\name.txt", System.Text.Encoding.ASCII)), this
special characters aren't appear.

If I try red this file with some unicode like UTF-8(the defualt
encodign for the OpenText() ) of course that did't work, because of
this character don't have 16 bit.
I'm not an expert of unicode matter.

Can someone help me reading this type of file for show his content in
web page.

Thank
 
Hi Leticia,

ASCII is 7 bit.

You have to use the Unicode. But I asume you are working in Spanish, why you
want to encode a Spanish characterset to a Spanish characterset?

Cor
 
Hello, leticia:

If the file was written in Windows it has probably ANSI encoding:
Dim oRead As StreamReader = New StreamReader("C:\...\name.txt", System.Text.Encoding.Default)

If it was written in DOS it was probably encoded with codepage 850:
Dim oRead As StreamReader = _
New StreamReader("C:\...\name.txt", New System.Text.Encoding(850))

If it was encoded with other codepage, substitute 850 with the codepage number. For example, US codepage is 437.

Regards.


"leticia larrosa" <[email protected]> escribió en el mensaje | Hi,
|
| I try to read a file that have 8 bit character, but contain some
| character
| whose code is more than 128 (spanish character).
|
| When I read this file using ASCII (Dim oRead As StreamReader = New
| StreamReader("C:\...\name.txt", System.Text.Encoding.ASCII)), this
| special characters aren't appear.
|
| If I try red this file with some unicode like UTF-8(the defualt
| encodign for the OpenText() ) of course that did't work, because of
| this character don't have 16 bit.
| I'm not an expert of unicode matter.
|
| Can someone help me reading this type of file for show his content in
| web page.
|
| Thank
 
Back
Top