c#どうやって中国語をutf-8符号化に変換するの?


UTF8Encoding utf8
=
new
UTF8Encoding();String unicodeString
=
"
大きなスイカ
"
;Byte[] encodedBytes
=
utf8.GetBytes(unicodeString);String decodedString
=
utf8.GetString(encodedBytes);Response.Write(decodeString);
string s = BitConverter.ToString(System.Text.Encoding.UTF8.GetBytes(" "));
string s = " ";
            string code = "";
            foreach (byte b in Encoding.UTF8.GetBytes(s))
            {
                code += '%' + b.ToString("X");
            }
            Console.WriteLine(code);
public static string UrlEncode(string str)
{
    if (str == null)
    {
        return null;
    }
    return UrlEncode(str, Encoding.UTF8);
}