Question

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);
Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top