简体   繁体   English

日语字符编码问题

[英]Japanese characters Encoding Issues

I am using a third party OCR Library to convert an Image containing Japanese characters to a text file. 我正在使用第三方OCR库将包含日语字符的图像转换为文本文件。 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. 当我通过双击打开创建的文本文件时看起来不错,但是当我使用下面的代码将其加载到TextBox中时,它变得很奇怪。

   this.textBox1.Text = File.ReadAllText(Outpath);

ReadAllText method can take the encoding as a parameter. ReadAllText方法可以将编码作为参数。

for a japanese file you should probably use: 对于日语文件,您可能应该使用:

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

if your file is encoded in UTF8: 如果您的文件使用UTF8编码:

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

Hope this helps, 希望这可以帮助,

Sylvain 西尔万

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM