转换编码方式

public string UtfEncode(string str)
        {
            byte[] buffer = Encoding.GetEncoding("UTF-8").GetBytes(str);
            string result = "";
            for (int i = 0; i < buffer.Length; i++)
            {
                result = result + "%" + buffer[i].ToString("x");
            }
            return result;
        }

posted on 2013-04-28 11:33  武胜-阿伟  阅读(166)  评论(0编辑  收藏  举报