英語以外のデータで WebRequest を使用すると、(サーバーからの) 矛盾がいくつか見られます。
String strData = "zéro";
// String strData = "zero"; // this works
request = WebRequest.Create("http://example.com");
request.Method = strMethod;
byte[] byteArray = Encoding.UTF8.GetBytes(strData);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = byteArray.Length;
((HttpWebRequest)request).UserAgent = "Sailthru API C# Client";
Stream dataStream = request.GetRequestStream();
// Write the data to the request stream.
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
これは、Java と PHP が期待どおりに動作しているときに C# を使用している場合にのみ発生するため、データのエンコード方法に関連している可能性があります。
私が間違っていることは何ですか?
あらかじめご了承ください。