473,320 Members | 1,979 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 1871
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Nick Chorley | last post by:
Lo all, I've written a simple program that connects to a POP3 server, allows me to authenticate and then retrieves a certain message. The problem I'm having is that when it retrives the message...
0
by: John C. Worsley | last post by:
I've got an extremely inscrutable problem here using Perl's Term::ReadLine::Gnu module. I'm using Perl 5.8.0, readline 4.3 and Term::ReadLine::Gnu 1.14. The problem is specific to catching INT...
1
by: Jian Qiu | last post by:
Hi, I tried to install python2.4.2. Unfortunately building 'readline' extension failed. Here is what I got: (It is a bit long. If you are impatient, please look at the end where it reports the...
5
by: Leonardo Hyppolito | last post by:
Hello! I am trying to implement a program that uses Threads. I chose the producers and consumers scenario. The producers put a "product" (which is an int number) in a shared storage place of one...
4
by: Leonardo Hyppolito | last post by:
Hello, I am trying to write a multithread program that simulates producers and consumers. My program can have many producers and many consumers (each in a separate thread). It has a storage...
2
by: James Wong | last post by:
Dear all, I'm using StreamReader to read a text file containing BIG-5 data and found that no matter which encoding method in StreamReader's construction parameter, the BIG-5 contents become...
2
by: Macisu | last post by:
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
2
by: TheSeeker | last post by:
Hi, As part of a larger project, I am trying to use the GNU Units program to provide unit conversions between quantities. My first iteration, which worked OK, was to simply use units as a...
0
by: iprogrammer | last post by:
i have a problem when i try to run my windows service ..which is "Error 1053: The service did not respond to the start or control request in a timely fashion" >after this i cannot anything with...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.