473,394 Members | 1,718 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,394 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 1878
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.