6

I'm having a problem trying to read Russian characters from a .txt file. The text always becomes corrupt when I read it. The file encoding is UTF8.

Here's the code:

  TextReader reader = new StreamReader(deliveryLocation, Encoding.UTF8);
  translatedContent = reader.ReadToEnd();
  reader.Close();

Can anyone tell me what I'm doing wrong? I've tried using all the supported encodings, but the text is always corrupted?

Here's a sample of the text I need to read from the file:

От таблиц выше мы см. чонсервной банкы тень и WinRunner брать3p приблизительно такое же время настраивать и запускать цикл испытания в будут немного NEOBXODIMO снимков экрана. Где более большой количество снимков экрана NEOBXODIMO, время бранное для того чтобы запускать тень чем время бранное для писания Кодего и для того чтобы выполнять оно в WinRunner. Примечания инженера в его отчете что WinRunner требовать3s сборка средства программирования под испытанием специально, котор нужно подготовить работать с им, тогда как тень не делает. Каждый ресурс включено страница должен иметь имя ШИЛА (ШИЛО будет языком стержня клиента собственническим).

Dharman
  • 30,962
  • 25
  • 85
  • 135
Jimmy Collins
  • 3,294
  • 5
  • 39
  • 57

2 Answers2

3

Use

TextReader reader = new StreamReader(deliveryLocation, Encoding.Defaut);
  translatedContent = reader.ReadToEnd();
  reader.Close();
2

Hello try the below to read Russian characters.

TextReader reader = new StreamReader(deliveryLocation, Encoding.GetEncoding("Windows-1252");
translatedContent = reader.ReadToEnd();
reader.Close();

and try to open the output data in Notepad++ with Encoding format as Cyrillic-1251.

Regards, Shambhu

N3R4ZZuRR0
  • 2,400
  • 4
  • 18
  • 32