troubleshooting Question

C#: How do you determine the encoding of a file

Avatar of trevor1940
trevor1940 asked on
.NET ProgrammingC#
21 Comments1 Solution328 ViewsLast Modified:
Hi
I have a text file with words like "intimate°" intimateý & tête-à-tête There's probably others

Is there a way to work out its encoding?  I'm guessing extended ASCII  

I've been using code bellow or similar StreamReader / StreamWriter like I said this a pure guess  

string[] AllLines = File.ReadAllLines(FileName,Encoding.GetEncoding("iso-8859-1"));

It looks OK on a sample file

Is there a Difference between StreamReader & File.Read..??

I'm assuming once you read a file into a string with a particular encoding the string inherits that encoding & this maintained if used in a class.
ASKER CERTIFIED SOLUTION
gr8gonzo
Consultant

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 21 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 21 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros