ASP.NET

ASP.NET MVC Naver API 에서 한글 utf8 파라미터 Encode

Sunny's 2010. 8. 27. 17:34



C# Naver API 에서 한글 utf8 파라미터 Encode 하기

 

 public static string EncodeText(string textToEncode)
{

            UTF8Encoding utf8 = new UTF8Encoding();
            Byte[] encodedBytes = utf8.GetBytes(textToEncode);
            string tempStr = "";
            foreach (Byte b in encodedBytes)
            {
                tempStr += "%" + string.Format("{0:X}", b);
            }
            return tempStr;

}