public class ANSIConversionAPI
    {
       
        const int SIMPLIFIED_CHINESE = 0x02000000;
        const int TRADITIONAL_CHINESE = 0x04000000;
       
       
       
        [DllImport("kernel32.dll", EntryPoint = "LCMapStringA")]
        public static extern int LCMapString(int Locale, int dwMapFlags, byte[] lpSrcStr, int cchSrc, byte[] lpDestStr, int cchDest);

 

 


        public  string BigToGb2312Ex(string str)
        {

            byte[] src = Encoding.GetEncoding(936).GetBytes(str);
            byte[] dest = new byte[src.Length];
            LCMapString(0x0804, SIMPLIFIED_CHINESE, src, -1, dest, src.Length);
            return Encoding.GetEncoding(936).GetString(dest);

        }

        public  string Gb2312ToGigEx(string str)
        {

            byte[] src = Encoding.GetEncoding(936).GetBytes(str);
            byte[] dest = new byte[src.Length];
            LCMapString(0x0804, TRADITIONAL_CHINESE, src, -1, dest, src.Length);
            return Encoding.GetEncoding(936).GetString(dest);
        }

 


    }

相关文章:

  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2021-12-05
猜你喜欢
  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案