Foreign letters in text file

A

al jones

I'll find an answer to this yet.

I'm trying to read (streamreader and textfieldparser) data from a file
which contains umlauted German characters and French with diacriticals.
Both streamreader and textfieldparser seem to drop those characters which
fall outside ascii range.

This is a text file (designers.txt) maintained from within VS 2005, the
characters are present in the text file but are dropped in the process of
reading them.

Code can be found in TextfieldParser (9/21/06 6:34 my time). Any
suggestions appreciated.

//al
 
H

Herfried K. Wagner [MVP]

al jones said:
I'm trying to read (streamreader and textfieldparser) data from a file
which contains umlauted German characters and French with diacriticals.
Both streamreader and textfieldparser seem to drop those characters which
fall outside ascii range.

Maybe the file has been stored using the system's Windows ANSI codepage.
'StreamReader' & Co. will use UTF-8 by default. Pass 'Encoding.Default' to
them in order to read the file using the system's Windows ANSI codepage.
 
A

al jones

Maybe the file has been stored using the system's Windows ANSI codepage.
'StreamReader' & Co. will use UTF-8 by default. Pass 'Encoding.Default' to
them in order to read the file using the system's Windows ANSI codepage.

uh-oh, this is scary, your normally cryptic (to me) references actually
sent me off looking and what I found works. Encoding.Default, for whatever
reason, gives me what I want. Thanks //al
 
C

Cor Ligthert [MVP]

Al,

I don't have the idea that Herfried gave an encrypted message, crazy me is
mostly giving a link to the MSDE or other pages. Herfried did that in past
as well, but you should know how much time that takes.

He gave you all information to use the keywords he gave you to do the search
yourself on MSDN or on other places.

Just my thought,

Cor
 
A

al jones

Cor, that wasn't a criticism of Herfried, much of what I read here is
cryptic to me because I don't know enough for it not to be. I haven't
programmed for a living in almost 15 years - I've just gotten into a
personal project that I wanted to do so I've had to learn more than I
really ever wanted to.

To me it's often like saying 'It's that way!' with a general flip of the
hand - if one doesn't really know what one is looking for then it's hard to
find, even with more specific direction.

Sorry Herfried if you took it as a criticism, it was really my way of
saying thanks for the guidance.

To both of you, thanks for the comments.

//al
 
H

Herfried K. Wagner [MVP]

al jones said:
Cor, that wasn't a criticism of Herfried, much of what I read here is
cryptic to me because I don't know enough for it not to be. I haven't
programmed for a living in almost 15 years - I've just gotten into a
personal project that I wanted to do so I've had to learn more than I
really ever wanted to.

Well, just to make it sure: If you have any further questions on my
explanations (or those given by others) feel free to ask :)!
Sorry Herfried if you took it as a criticism, it was really my way of
saying thanks for the guidance.

No problem. I just want to make sure that I do not write answers people do
not understand.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top