How to determine the encoding of a webresponse stream ?
Asked
Active
Viewed 691 times
3
-
[Response.ContentEncoding.EncodingName](http://msdn.microsoft.com/en-us/library/system.web.httpresponse.contentencoding%28VS.71%29.aspx) – Bartek Tatkowski Mar 30 '10 at 08:21
-
This refers to a HttpResponse, not a WebResponse. – Jun 11 '12 at 12:55
1 Answers
1
I presume you're interested in HTML content. Actually this is not really an easy task. What most browsers do is use the encoding, the unicode bytes (at the start of your document) and HTML headers as hints, while trying different charsets to see if there's a '
The details of the algorithm are outlined in 8.2.2.1 of the HTML5 specification, see: http://www.w3.org/html/wg/drafts/html/master/single-page.html .

atlaste
- 30,418
- 3
- 57
- 87