Note that there are some explanatory texts on larger screens.

plurals
  1. POUTF-8 is not working for TextArea contents
    primarykey
    data
    text
    <p>I'm interacting a website using <code>HttpRequest</code>s in C#<br> I can read the page contents but when i try to post some information back to the server, everything works correctly but not about the value of <code>TextArea</code>s in the page...<br> The text I'm trying to set for them is in <strong>Persian (Farsi)</strong> and the page I'm receiving is set for <strong>Windows-1256</strong> encoding... </p> <p>The problem is that the content of the <code>textarea</code> is not shown as I expect in Farsi! </p> <p><strong>Update:</strong> here is the code I use to send the request: </p> <pre><code>public static string PostMultipart(string URL, List&lt;RequestParameterInfo&gt; parameters, List&lt;string&gt; cookies, string referer, string acceptLanguage, string acceptCharset, object KeepAliveValue) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(URL)); var boundary = "---------------------------7dc283270344"; var messageBytes = Encoding.UTF8.GetBytes("--" + boundary); foreach (var item in parameters) { var prefixBytes = Encoding.UTF8.GetBytes("\n"); var itemBytes = item.ToBytes(); var postfixBytes = Encoding.UTF8.GetBytes("\n--" + boundary); var startIndex = messageBytes.Length; Array.Resize&lt;byte&gt;(ref messageBytes, messageBytes.Length + itemBytes.Length + prefixBytes.Length + postfixBytes.Length); prefixBytes.CopyTo(messageBytes, startIndex); itemBytes.CopyTo(messageBytes, startIndex + prefixBytes.Length); postfixBytes.CopyTo(messageBytes, startIndex + prefixBytes.Length + itemBytes.Length); } var lastPostfixBytes = Encoding.UTF8.GetBytes("--"); var startIndex2 = messageBytes.Length; Array.Resize&lt;byte&gt;(ref messageBytes, messageBytes.Length + lastPostfixBytes.Length); lastPostfixBytes.CopyTo(messageBytes, startIndex2); request.Headers.Clear(); request.Accept = "application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, */*"; request.Headers.Add(HttpRequestHeader.Pragma, "no-cache"); request.ContentLength = messageBytes.Length; request.Referer = referer; request.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3)"; request.ContentType = "multipart/form-data; boundary=" + boundary; request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip, deflate"); request.Headers.Add(HttpRequestHeader.AcceptLanguage, acceptLanguage); if (!string.IsNullOrWhiteSpace(acceptCharset)) request.Headers.Add(HttpRequestHeader.AcceptCharset, acceptCharset); if (KeepAliveValue is Boolean) request.KeepAlive = (bool)KeepAliveValue; else request.Headers.Add(HttpRequestHeader.KeepAlive, (string)KeepAliveValue); request.Expect = null; request.CookieContainer = new CookieContainer(); foreach (var item in cookies) request.CookieContainer.SetCookies(new Uri(URL), item); request.AllowWriteStreamBuffering = true; request.Method = "POST"; using (var strm = request.GetRequestStream()) { strm.Write(messageBytes, 0, messageBytes.Length); } string resPage = ""; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { using (StreamReader srResponse = new StreamReader(response.GetResponseStream())) { resPage = srResponse.ReadToEnd(); } } return resPage; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload