473,398 Members | 2,343 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,398 software developers and data experts.

How to use streamreader to read ascii 8 charecters

Friends,

Want to read a textfile with characters that go above 7F ( ascii > 128) and
put the results line by line in a string to process it further
I used a streamreader to do so but the readline() methods in someway skipps
the characters > 127 .
I used the binary reader as well, same result.

string regel;
StreamReader sr = new StreamReader ( ImportFile, System.Yext.Unicode.UTF8);
While ( regel = sr.readline()) !=null)
{
I do something here
}

How to solve this?

Regards

Gerrit Esmeijer

Nov 16 '05 #1
4 3078
G.Esmeijer <ge****@nomail.nl> wrote:
Want to read a textfile with characters that go above 7F ( ascii > 128)


There's no such thing as ASCII > 128.

Perhaps you mean Encoding.Default?

See http://www.pobox.com/~skeet/csharp/unicode.html

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
Yes you caught me. Fine OK Sorry
but now to the point.

I tried several things. What I would like is reading a string that consists
of characters them a degree sign en a diameter sing ( zero with a cross line
(alt-155 on your keyboard - I would not dare to say ascii-155) :-) ); put
them in a string variable and store the result in a
field in a database. Leter I need to make lists with on them the same
characers againg.
And how about all those names with Umlauts (German) like ü , ö , ë etc.
There must be a way to simply read those chracters and store them in a
string variable.

Converting to ascii converts althose character > 127 into a ?
(ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùø£Ø×fáí etc)
For me, coming from vb6 this was no problem.
Now in C# I have till now not found a way to read these characters . In
spite of all the explenation tou are referring to.

PLEASE show me a piece of code that puts these Character into a string.
Regards, gerrit Esmeijer




"Jon Skeet [C# MVP]" <sk***@pobox.com> schreef in bericht
news:MP************************@msnews.microsoft.c om...
G.Esmeijer <ge****@nomail.nl> wrote:
Want to read a textfile with characters that go above 7F ( ascii > 128)


There's no such thing as ASCII > 128.

Perhaps you mean Encoding.Default?

See http://www.pobox.com/~skeet/csharp/unicode.html

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #3
G.Esmeijer <ge****@nomail.nl> wrote:
Yes you caught me. Fine OK Sorry
but now to the point.

I tried several things. What I would like is reading a string that consists
of characters them a degree sign en a diameter sing ( zero with a cross line
(alt-155 on your keyboard - I would not dare to say ascii-155) :-) ); put
them in a string variable and store the result in a
field in a database. Leter I need to make lists with on them the same
characers againg.
And how about all those names with Umlauts (German) like ü , ö , ë etc.
There must be a way to simply read those chracters and store them in a
string variable.
Absolutely - but where are you trying to read them from? What's teh
file format, if you're reading it from a file?
Converting to ascii converts althose character > 127 into a ?
(ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùø£Ø×fáí etc)
Yes, it would, as those characters aren't in ASCII.
For me, coming from vb6 this was no problem.
Now in C# I have till now not found a way to read these characters . In
spite of all the explenation tou are referring to.

PLEASE show me a piece of code that puts these Character into a string.


Have you tried Encoding.Default as I suggested?

Did you read the page I directed you to?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4
Jon,
First I did not know want you ment by >> Default <<. Since you are referring
to it for the second time I got into the theory a bit more and see, the
Nickle fell and it worked.
Things that are obvious for some people do not need to be that for other
(among them is me) <<

Thanks
Gerrit

"Jon Skeet [C# MVP]" <sk***@pobox.com> schreef in bericht
news:MP************************@msnews.microsoft.c om...
G.Esmeijer <ge****@nomail.nl> wrote: Yes you caught me. Fine OK Sorry
but now to the point.

I tried several things. What I would like is reading a string that consists of characters them a degree sign en a diameter sing ( zero with a cross line (alt-155 on your keyboard - I would not dare to say ascii-155) :-) ); put
them in a string variable and store the result in a
field in a database. Leter I need to make lists with on them the same
characers againg.
And how about all those names with Umlauts (German) like ü , ö , ë etc.
There must be a way to simply read those chracters and store them in a
string variable.
Absolutely - but where are you trying to read them from? What's teh
file format, if you're reading it from a file?
Converting to ascii converts althose character > 127 into a ?
(ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùø£Ø×fáí etc)
Yes, it would, as those characters aren't in ASCII.
For me, coming from vb6 this was no problem.
Now in C# I have till now not found a way to read these characters . In
spite of all the explenation tou are referring to.

PLEASE show me a piece of code that puts these Character into a string.


Have you tried Encoding.Default as I suggested?

Did you read the page I directed you to?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #5

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

Similar topics

4
by: Jason Gleason | last post by:
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...
4
by: G.Esmeijer | last post by:
Friends, Want to read a textfile with characters that go above 7F ( ascii > 128) and put the results line by line in a string to process it further I used a streamreader to do so but the...
2
by: Keith Kingsley | last post by:
I'm using a StreamReader to read in several lines from an ASCII file. I'd like to know the StreamReader's "true" position-- that is, the number of bytes into the file that the StreamReader has...
0
by: Ed West | last post by:
Hi, I am trying to read a file, make changes, and write it to a new file. The original file has the copyright character © which is ascii 169 I believe, which is more than 7 bits. I am using...
3
by: pabelard | last post by:
I am reading from a file and trying to find out if it has characters above ASCII 127 in it. My sample file does have several of these characters. However, the streamreader seems to skip over...
7
by: sweetpotatop | last post by:
Hello, I have a txt file which has a few lines of special characters: This is A line from the text file: ...
0
by: rajana | last post by:
Dear All, We have Ansi file with german characters (Ä / Ø) , We are using Streamreader to read the contents of the file. But Readline() not able to read the German characters. We tried all...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.