I write the data from the buffer to a text file (Russian text). I tried it first
public static void WriteFinalInfoInFile() { string finalInfo = postTrack + " " + location + "\n"; File.AppendAllText("finalResult.txt", finalInfo); //write in file } then so
public static void WriteFinalInfoInFile() { string finalInfo = postTrack + " " + location + "\n"; File.AppendAllText("finalResult.txt", finalInfo, Encoding.GetEncoding(1251)); //write in file } In both cases, Russian words are written as ????????????? ??????? ????????????? ??????? . There are no problems with the Latin record.
AppendAllTextit is clear that it adds text to an already existing file. Accordingly, you need to add with the same encoding with which this file was created. I note that the default encoding is used, corresponding to the locale of the OS. Conclusion: always specify the encoding when writing / reading to / from the file (s). If you hesitate what to choose - take UTF-8. - Alexander Petrov