c# 关于iphone 传值中文字符乱码的问题

来源:互联网 发布:淘宝店铺营销怎么写 编辑:程序博客网 时间:2024/06/11 18:55

 在写iphone 接口过程中乱码问题困惑了很久,经过一番周折终于找到了解决方案希望对大家有所帮助

 

 

 /// <summary>
        /// 对中文utf8 进行转换
        /// </summary>
        /// <param name="searchKey"></param>
        /// <returns></returns>
        public static string CheckCoding(string searchKey)
        {
            byte[] utfByte = Encoding.UTF8.GetBytes(searchKey);
            string str = HttpUtility.UrlDecode(utfByte, System.Text.Encoding.UTF8);
            return str;
        }

 

 

 

原创粉丝点击