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

查看:201
本文介绍了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.

  1. 创建新文件并将ÇÎÊÈÇÑ粘贴到其中.
  2. 转到编码菜单导航->字符集->阿拉伯语-> ISO-8859-6/Windows-1256
  1. Create New file and paste ÇÎÊÈÇÑ in it.
  2. 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);  

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

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