ISO-8859-6 to UTF-8

Deadly 提交于 2019-12-11 15:22:46

问题


How do I convert ISO-8859-6 to Arabic?

I have some encoded characters, e.g. ÇÎÊÈÇÑ. This is nothing but “Test” in English and اختبار in Arabic.

I want these characters as an input and Arabic as an output. To test further in Notepad++, try the following steps to get a better idea.

  1. Create New file and paste ÇÎÊÈÇÑ in it.
  2. Go to encoding menu navigation -> Character Set -> Arabic -> ISO-8859-6/Windows-1256

It shows Arabic characters, which is nothing but “test” (Google Translator). Actually, I want to replicate the reverse process, however I am unable to do same process L. This is the code I'm trying:

byte[] utf8Bytes = Encoding.UTF8.GetBytes("ÇÎÊÈÇÑ");
System.Text.Encoding iso_8859_6 = System.Text.Encoding.GetEncoding("ISO-8859-6");
byte[] isoBytes = Encoding.Convert(Encoding.Unicode, iso_8859_6, utf8Bytes);
string unicodeconverted = Encoding.Unicode.GetString(isoBytes);
//string uf8converted = Encoding.UTF8.GetString(isoBytes);

回答1:


Quick conversion of a windows-1256 file to utf8:

string data = File.ReadAllText(path, Encoding.GetEncoding("windows-1256"));  
File.WriteAllText(path, data, Encoding.UTF8);  


来源:https://stackoverflow.com/questions/12448060/iso-8859-6-to-utf-8

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!