在寫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;
}