public string toGB2312(string thestr)
        {
         
            Byte[] encodedBytes = new byte[thestr.Length * 2];
            int iCount = Encoding.GetEncoding("gb2312").GetBytes(thestr, 0, thestr.Length, encodedBytes, 0);
            string GetGB22312String = "";
            foreach (Byte b in encodedBytes)
            {
                string strValue = Convert.ToString(b, 16);
                //strValue = strValue.ToUpper();
                GetGB22312String += "%" + strValue;
            }
            return GetGB22312String;
        }

解决方案 »

  1.   

    Multi-Language Add-In for Visual Studio 2010 
      

  2.   


        public string toGB2312(string thestr)
            {
           
                Byte[] encodedBytes = new byte[thestr.Length * 2];
                encodedBytes = Encoding.GetEncoding("gb2312").GetBytes(thestr);
                string GetGB22312String = "";
                foreach (Byte b in encodedBytes)
                {
                    string strValue = Convert.ToString(b, 16);
                    //strValue = strValue.ToUpper();
                    GetGB22312String += "%" + strValue;
                }
                return GetGB22312String;
            }