ISO-8859-6 到 UTF-8 [英] ISO-8859-6 to UTF-8

查看:33
本文介绍了ISO-8859-6 到 UTF-8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将 ISO-8859-6 转换为阿拉伯语?

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

我有一些编码字符,例如ÇÎÊÈÇÑ.这只不过是英语的Test"和阿拉伯语的اختبار.

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.

  1. 创建新文件并将ÇÎÊÈÇÑ粘贴到其中.
  2. 转到编码菜单导航 -> 字符集 -> 阿拉伯语 -> 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);  

这篇关于ISO-8859-6 到 UTF-8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆