Reputation: 21
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.
ÇÎÊÈÇÑ
in it.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);
Upvotes: 1
Views: 2799
Reputation: 19156
Quick conversion of a windows-1256 file to utf8:
string data = File.ReadAllText(path, Encoding.GetEncoding("windows-1256"));
File.WriteAllText(path, data, Encoding.UTF8);
Upvotes: 2