Classes

Method HttpRequestMessage() :setAcceptCharset() Foundation

Defines the accepted charset for responses from the server.

Syntax
 
:setAcceptCharset( <cCharset> | <aCharsets> ) --> self
Parameters
<cCharset>
A character string with a charset identifier.
<aCharsets>
An array of charset identifiers specified as character strings. The elements in the array may optionally be weighted by using a so-called quality value. The quality value is a value between 0 and 1 denoting the charset's priority. A weight value of 1 (the default) is equivalent to the highest priority.
Example: 
:setAcceptCharset( "utf8" ) // specific charset 
:setAcceptCharset( {"utf8", "iso-8859-1;q=0.5"} ) // weighted charset list 
Return

:setAcceptCharset() returns the object executing the method.

Description

The method :setAcceptCharset() specifies to the server which character set(s) the client is able to unterstand when processing data sent by the server.

The accepted charset is a discretionary element in the request header. Although servers are expected to respect the proposal(s) made by the client, there is no guarantee the response will be in the desired format. Consequently, the "Content-Type" HTTP header in the server's response should be checked prior to processing the response data. See the method :getHeaders() for further information.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.