471,339 Members | 1,330 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,339 software developers and data experts.

Problem using ReadLine() with StreanReader

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 (:ToCharArray());
s=System.text.Encoding.ASII.GetString(bytes);

s is wrong,

Ideas?

Jul 22 '05 #1
2 1795
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 (:ToCharArray());
s=System.text.Encoding.ASII.GetString(bytes);

s is wrong,

Ideas?

Jul 22 '05 #2
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" <Ma****@discussions.microsoft.com> wrote in message
news:CE**********************************@microsof t.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 (:ToCharArray());
| s=System.text.Encoding.ASII.GetString(bytes);
|
| s is wrong,
|
| Ideas?
|
Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Nick Chorley | last post: by
reply views Thread by John C. Worsley | last post: by
1 post views Thread by Jian Qiu | last post: by
5 posts views Thread by Leonardo Hyppolito | last post: by
4 posts views Thread by Leonardo Hyppolito | last post: by
2 posts views Thread by TheSeeker | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.