(Sorry if this is a dupe)
I've just spent a long time trying to read a text file correctly.
Having started with File.ReadAllText(path)
and getting screwed-up characters, I tried several variants of File.ReadAlltext(path, Encoding)
after which I got bogged down trying to analyse my input files to work out which byte was the problem, etc.
In desperation I tried File.ReadAllText(path, Encoding.Default)
, which worked!
I'm now struggling to understand why the default value is apparently only the default value if you specify it.
(My cut-down test string was +4433ç
, I saved it in notepad as ANSI - though with Swiss French regional settings...)