Response CharEncoding Property C# API
Gets or sets the character encoding that is used to decode the data contained in this Response, for example "UTF-8".

Namespace: Facilita.Web
Assembly: clrWebBrowser (in clrWebBrowser.dll) Version: 9.5.7.98 (1.0.0.0)
Syntax

public Encoding CharEncoding { get; set; }

Field Value

The character encoding.
Remarks

Usually, the character encoding will be determined automatically by:
  • looking for a charset in the response headers (e.g. Content-Type: text/html; charset=utf-8)
  • looking for a meta-tag in the HTML (e.g. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  • looking for a Byte Order Mark at the beginning of the response data
  • defaulting to ISO-8859-1 (latin-1) if none of the above could be found

Therefore, it is not usually necessary to call this method explicitly. However, if some of the information above is incorrect/missing, then you can override the encoding by calling this method.

Examples

The following example demonstrates setting the character encoding before the call to VerifyTitle(). e.g.
Response response = request.Send(); 

// Use the utf-8 character set to interpret the data in this response
response.CharEncoding = Encoding.UTF8;

// The utf-8 character set will be used to decode the HTML and determine what the title is 
response.VerifyTitle("我是中国人", ActionType.ACT_NEXT_ITERATION);
See Also

Response CharEncoding