문제

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