public async String getData()
{
if (HttpClientWork == false)
{
HttpContent content;
content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("Data", StringToEncoding("한글테스트"))
});
MediaTypeHeaderValue mediatype = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
mediatype.CharSet = "euc-kr";
mediatype.MediaType = "application/x-www-form-urlencoded";
content.Headers.ContentType = mediatype;
try
{
HttpResponseMessage response = await httpClient.PostAsync("http://~~~~~~~~", content);
html = StringToEncoding(responseMessage);
System.Diagnostics.Debug.WriteLine(html);
....
}
catch (Exception e)
{
....
}
}
else
{
......
}
StringToEncoding Function Source
public static String StringToEncoding(String str)
{
Encoding encode = System.Text.Encoding.GetEncoding("euc-kr");
byte[] byteencode = encode.GetBytes(str);
return encode.GetString(byteencode, 0, byteencode.Length);
}
But, Receive data from the server.
��������
As above, Korean is broken.
I don't know How to send data which converted euc-kr from utf-8 in httpclient.