我需要将Shift-JIS编码[8140-EAA4]转换为对应的字符。
例如:
88A0 -> 唖
88A1 -> 娃
88A2 -> 阿

解决方案 »

  1.   

    据说可以这样
    用gedit!
    打开中文文件,然后save as,在对话框里选Character Coding里面的Add or Remove,再选shift_jis编码,存盘,就行了。
      

  2.   

    http://msdn2.microsoft.com/en-us/library/aa332096(VS.71).aspx
      

  3.   

    我的目的是将Shift-JIS编码范围[8140-EAA4]内的所有字符生成到文本文件中,而不是将其它编码格式的字符串转换为Shift-JIS。
      

  4.   

    Encoding encoding = Encoding.GetEncoding("Shift-JIS");
    string s = "88A0";
                byte[] bytes = new byte[s.Length / 2];
                for (int i = 0, j = 0; i < s.Length; i += 4, j += 2)
                {
                    bytes[j] = Convert.ToByte(s.Substring(i, 2), 16);
                    bytes[j + 1] = Convert.ToByte(s.Substring(i + 2, 2), 16);
                }
                string temp = encoding.GetString(bytes);
      

  5.   

    Decoder decoder = Encoding.GetEncoding(932).GetDecoder();
    char[] c = new char[1];
    decoder.GetChars(new byte[] { 0x88, 0xA1 }, 0, 2, c, 0);
    Console.WriteLine(c[0]);