C# Help Reading Foreign Characters Using Streamreader

C# Help reading foreign characters using StreamReader

Yes, it could be with the actual encoding of the file, probably unicode. Try UTF-8 as that is the most common form of unicode encoding. Otherwise if the file ASCII then standard ASCII encoding should work.

Not able to read special character £ using Streamreader in c#

Try to replace Encoding.Default with Encoding.GetEncoding(437)

StreamReader from .csv - foreign chars and blank values showing up as '?'

"Fixed" it by going with tab delimited unicode .txt file instead of .csv. For some reason my version of excel doesn't have the option to save in unicode .csv...

Don't quite understand the problem of "rolling my own" parser, but maybe someday someone will take the time to explain it to me better. Still new-ish at this c# stuff...

how to read special character like é, â and others in C#

There is no such thing as "special character". What those likely are is extended ascii characters from the latin1 set (iso-8859-1).
You can read those by supplying encoding explicitly to the stream reader (otherwise it will assume UTF8)

using (StreamReader r = new StreamReader(fileName, Encoding.GetEncoding("iso-8859-1")))
r.ReadToEnd();


Related Topics



Leave a reply



Submit