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
  • 15,539
  • 54
  • 145
  • 264

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
  • 126,196
  • 18
  • 182
  • 330
  • 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