Problem using ReadLine() with StreanReader
am 08.07.2005 00:57:03 von Macisu
Hi
I am using the object Stream Reader to read Files. The method ReadLine()
does not read the character ñ o Ã.
What Can i do?
Helpme please
thanks
Macisu
It does not work
StreamReader sFile = new StreamReader(ASCIIEncoding.ASCII);
byte[] bytes =
System.Text.Encoding.ASCII.Getbytes(sFile.ReadLine(:ToCharAr ray());
s=System.text.Encoding.ASII.GetString(bytes);
s is wrong,
Ideas?
RE: Problem using ReadLine() with StreanReader
am 08.07.2005 04:16:01 von Marshal
Hi Macisu:
Please try to use UTF8 encoding
==>StreamReader sFile = new StreamReader(ASCIIEncoding.ASCII);
to:
StreamReader sFile = new StreamReader(System.Text.Encoding
..UTF8);
--
Help you,Help me.
"Macisu" wrote:
> Hi
>
> I am using the object Stream Reader to read Files. The method ReadLine()
> does not read the character ñ o Ã.
>
> What Can i do?
>
> Helpme please
>
> thanks
>
> Macisu
>
> It does not work
>
> StreamReader sFile = new StreamReader(ASCIIEncoding.ASCII);
>
> byte[] bytes =
> System.Text.Encoding.ASCII.Getbytes(sFile.ReadLine(:ToCharAr ray());
> s=System.text.Encoding.ASII.GetString(bytes);
>
> s is wrong,
>
> Ideas?
>
Re: Problem using ReadLine() with StreanReader
am 10.07.2005 15:22:50 von Jay_Harlow_MVP
Marcisu,
As Marshal suggets, ASCII does not include the ñ & Ñ characters, as ASCII is
a 7 bit encoding. You need an 8 or 16 bit encoding to read ñ & Ñ.
In addition to trying the UTF8 encoding I would recommend the Default
encoding, as that is the encoding that is specific under your Windows
Control Panels.
Something like:
| StreamReader sFile = new StreamReader(filename,
System.Text.Encoding.Default);
Hope this helps
Jay
"Macisu" wrote in message
news:CE7D1230-74B3-48D6-B433-1E640B9F816E@microsoft.com...
| Hi
|
| I am using the object Stream Reader to read Files. The method ReadLine()
| does not read the character ñ o Ñ.
|
| What Can i do?
|
| Helpme please
|
| thanks
|
| Macisu
|
| It does not work
|
| StreamReader sFile = new StreamReader(ASCIIEncoding.ASCII);
|
| byte[] bytes =
| System.Text.Encoding.ASCII.Getbytes(sFile.ReadLine(:ToCharAr ray());
| s=System.text.Encoding.ASII.GetString(bytes);
|
| s is wrong,
|
| Ideas?
|