I am trying to read portuguese characters from files, and keep getting into problems.
我有以下C#代码(用于测试):
var streamReader = new StreamReader("file.txt");
while (streamReader.Peek() >= 0)
{
var buffer = new char[1];
streamReader.Read(buffer, 0, buffer.Length);
Console.Write(buffer[0]);
}
It reads each character in the file and then outputs it to the console. The file contains the following: "cãsa". The output in the console is: "c?sa".
我做了什么错误?