Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading an UTF8 file, problems

Tags:

c#

file-io

utf-8

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?

like image 966
Jack Avatar asked Sep 04 '26 14:09

Jack


1 Answers

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?

like image 115
Jim Mischel Avatar answered Sep 07 '26 03:09

Jim Mischel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!