string ss = "\\u674e\\u660e";
Response.Write(HttpUtility.UrlDecode(ss));结果是:\u674e\u660e
string ss = "\u674e\u660e";
Response.Write(HttpUtility.UrlDecode(ss));结果是:李明
如何让"\\u674e\\u660e" 转成 "\u674e\u660e"啊
"\\u674e"是字符串类型
'\u674e' 是char类型的
搞了一上午了,还是没想出什么好的办法,大家可以挑战一下

解决方案 »

  1.   

    不是有replace()函数吗....
    貌似其他的一些字符串函数都能办到吧
      

  2.   

    可以不用HttpUtility.UrlDecode ,自己写一个转码的 public static string UnicodeToString(string srcText)
            {
                string dst = "";
                try
                {
                     
                   
                    if (srcText.Length > 0)
                    {                    srcText = srcText.Substring(0, srcText.Length);
                        string src = srcText;
                        int len = srcText.Length/6;                    for (int i = 0; i <= len - 1; i++)
                        {
                            string str = "";
                            str = src.Substring(0, 6).Substring(2);
                            src = src.Substring(6);
                            byte[] bytes = new byte[2];
                            bytes[1] = byte.Parse(int.Parse(str.Substring(0, 2), NumberStyles.HexNumber).ToString());
                            bytes[0] = byte.Parse(int.Parse(str.Substring(2, 2), NumberStyles.HexNumber).ToString());
                            dst += Encoding.Unicode.GetString(bytes);
                        }
                    }
                }
                catch (Exception)
                {
                    dst = srcText;
                }
                return dst;
            }
    自己 再完善下  看看能不能满足你的要求
      

  3.   

    ss.Replace("\\","\");
    正如四楼说的加@符号应该也可以的吧,试看看啊
      

  4.   

    string ss = "\\u674e\\u660e";
    Response.Write(HttpUtility.UrlDecode(ss.Replace("\\", "%")));//结果是:李明