473,385 Members | 1,934 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,385 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 2195
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: 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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...

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.