2005年10月18日

Find encoding problem with French

Nowadays, I was processing some French corpus. I programmed in C#. Original I used
StreamReader SR = new StreamReader(FilePath);
StreamWriter SW = new StreamWriter(FilePath);
to read the files.

But there was some errors during the process. To English, it was right. But to French, all the hats of some characters changed their form. The hats were lose. It was a terrible thing.

After debugging and searching solution, I used
StreamReader SR = new StreamReader(InFilePath,System.Text.Encoding.Default);
StreamWriter SW = new StreamWriter(OutFilePath,false,System.Text.Encoding.Default);
to read and write file respectively.

Now I know, French should be used some western encoding format to read and write. In C#, you use System.Text.Encoding.Defaultcan solve it.

没有评论: