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