473,387 Members | 3,821 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,387 software developers and data experts.

é writing out from a streamreader??

I'm having a problem with the streamreader class. When i read out of a file,
characters like é are taken out when i do readline. Why does this happen?
When i switch the encoding to ascii, it replaces those characters with a
question mark. How do i get them to read correctly from a file? So the
character é is correctly read into the .net program?
Nov 15 '05 #1
4 2353
This link should tell you all you need to know:
http://www.yoda.arachsys.com/csharp/unicode.html

--
C#, .NET and Complex Adaptive Systems:
http://blogs.geekdojo.net/Richard
"Jason Gleason" <ja***********@gensurvey.com> wrote in message
news:OT**************@TK2MSFTNGP12.phx.gbl...
I'm having a problem with the streamreader class. When i read out of a file, characters like é are taken out when i do readline. Why does this happen?
When i switch the encoding to ascii, it replaces those characters with a
question mark. How do i get them to read correctly from a file? So the
character é is correctly read into the .net program?

Nov 15 '05 #2
This link should tell you all you need to know:
http://www.yoda.arachsys.com/csharp/unicode.html

--
C#, .NET and Complex Adaptive Systems:
http://blogs.geekdojo.net/Richard
"Jason Gleason" <ja***********@gensurvey.com> wrote in message
news:OT**************@TK2MSFTNGP12.phx.gbl...
I'm having a problem with the streamreader class. When i read out of a file, characters like é are taken out when i do readline. Why does this happen?
When i switch the encoding to ascii, it replaces those characters with a
question mark. How do i get them to read correctly from a file? So the
character é is correctly read into the .net program?

Nov 15 '05 #3

"Jason Gleason" <ja***********@gensurvey.com> wrote in message
news:OT**************@TK2MSFTNGP12.phx.gbl...
I'm having a problem with the streamreader class. When i read out of a file, characters like é are taken out when i do readline. Why does this happen?
When i switch the encoding to ascii, it replaces those characters with a
question mark. How do i get them to read correctly from a file? So the
character é is correctly read into the .net program?


When the characters where stored in the stream, a specific text encoding was
used to translate the characters into a sequence of bytes. You need to know
what encoding that was in order to read the stream properly. ASCII won't
work because é isn't in the ASCII character set.

Try other encodings such as UTF8, iso-8859-1, etc. To get an Encoding object
for iso-8859-1, use Encoding.GetEncoding("iso-8859-1") and pass this to the
StreamReader constructor.
Nov 15 '05 #4

"Jason Gleason" <ja***********@gensurvey.com> wrote in message
news:OT**************@TK2MSFTNGP12.phx.gbl...
I'm having a problem with the streamreader class. When i read out of a file, characters like é are taken out when i do readline. Why does this happen?
When i switch the encoding to ascii, it replaces those characters with a
question mark. How do i get them to read correctly from a file? So the
character é is correctly read into the .net program?


When the characters where stored in the stream, a specific text encoding was
used to translate the characters into a sequence of bytes. You need to know
what encoding that was in order to read the stream properly. ASCII won't
work because é isn't in the ASCII character set.

Try other encodings such as UTF8, iso-8859-1, etc. To get an Encoding object
for iso-8859-1, use Encoding.GetEncoding("iso-8859-1") and pass this to the
StreamReader constructor.
Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: JSM | last post by:
Hi, I am just trying to port an existing simple encryption routine to C#. this routine simply adds/substracts 10 ascii characters to each character in a text file (except quotes). The routine...
2
by: melanieab | last post by:
Hi, I'm trying to store all of my data into one file (there're about 140 things to keep track of). I have no problem reading a specific string from the array file, but I wasn't sure how to...
1
by: Bishoy George | last post by:
I want a link to a nice documentation about writing to a server file by C# using System.IO; .
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.