3

I'm reading a text file with UTF-8 encoding. Some lines of file includes accents. Something like this: EdiçÃo. But on Console and LINQPad output Edi��o instead of.

Here's how to I'm reading the file:

File.ReadAllLines("foo.txt", Encoding.UTF8);

How to fix this?

Jack
  • 16,276
  • 55
  • 159
  • 284

1 Answers1

8

I can't say what the problem is with LINQPad, but the console is probably set to a different code page and doesn't have those characters in its font. See Unicode characters in Windows command line - how?

Community
  • 1
  • 1
Jim Mischel
  • 131,090
  • 20
  • 188
  • 351
  • This. It is most likely simply a case of the font you are using not having the characters you wish to display. To verify, run your application in debug and put a breakpoint after you read the file. If the byte values are all correct, you're all set. Just change your output font. – dodexahedron Jun 11 '12 at 22:30