ISO-8859-6至UTF-8
如何将ISO-8859-6转换为阿拉伯语?
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.
我希望这些字符作为输入,而阿拉伯语作为输出.要在Notepad ++中进行进一步测试,请尝试以下步骤以获得更好的主意.
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.
- 创建新文件并将
ÇÎÊÈÇÑ
粘贴到其中. - 转到编码菜单导航->字符集->阿拉伯语-> ISO-8859-6/Windows-1256
- Create New file and paste
ÇÎÊÈÇÑ
in it. - Go to encoding menu navigation -> Character Set -> Arabic -> ISO-8859-6/Windows-1256
它显示阿拉伯字符,不过就是测试"(Google Translator
).
实际上,我想复制相反的过程,但是我无法执行相同的过程L.
这是我正在尝试的代码:
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);
将Windows-1256文件快速转换为utf8:
Quick conversion of a windows-1256 file to utf8:
string data = File.ReadAllText(path, Encoding.GetEncoding("windows-1256"));
File.WriteAllText(path, data, Encoding.UTF8);