Вопрос

I am using a third party OCR Library to convert an Image containing Japanese characters to a text file. The Text file created looks alright when I open it by double clicking but when I load it in TextBox using the code below it becomes strange.

   this.textBox1.Text = File.ReadAllText(Outpath);
Это было полезно?

Решение

ReadAllText method can take the encoding as a parameter.

for a japanese file you should probably use:

this.textBox1.Text = File.ReadAllText(Outpath, Encoding.Unicode);

if your file is encoded in UTF8:

this.textBox1.Text = File.ReadAllText(Outpath, Encoding.UTF8);

Hope this helps,

Sylvain

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top