=encoding utf-8 =head1 NAME ngx_http_charset_module - Module ngx_http_charset_module =head1 The C module adds the specified charset to the C response header field. In addition, the module can convert data from one charset to another, with some limitations: =over =item * conversion is performed one way — from server to client, =item * only single-byte charsets can be converted =item * or single-byte charsets toEfrom UTF-8. =back =head1 Example Configuration include conf/koi-win; charset windows-1251; source_charset koi8-r; =head1 Directives =head2 charset B charset I> E C> B I B I B I B I B I Adds the specified charset to the C response header field. If this charset is different from the charset specified in the L directive, a conversion is performed. The parameter C cancels the addition of charset to the C response header field. A charset can be defined with a variable: charset $charset; In such a case, all possible values of a variable need to be present in the configuration at least once in the form of the L, L, or L directives. For C, C, and C charsets, it is sufficient to include the files Fkoi-win>, Fkoi-utf>, and Fwin-utf> into configuration. For other charsets, simply making a fictitious conversion table works, for example: charset_map iso-8859-5 _ { } In addition, a charset can be set in the C response header field. This capability can be disabled using the L, L, L, and L directives. =head2 charset_map B charset_map I> I> { B<...> } > B I Describes the conversion table from one charset to another. A reverse conversion table is built using the same data. Character codes are given in hexadecimal. Missing characters in the range 80-FF are replaced with “C”. When converting from UTF-8, characters missing in a one-byte charset are replaced with “C#XXXX;>”. Example: charset_map koi8-r windows-1251 { C0 FE ; # small yu C1 E0 ; # small a C2 E1 ; # small b C3 F6 ; # small ts ... } When describing a conversion table to UTF-8, codes for the UTF-8 charset should be given in the second column, for example: charset_map koi8-r utf-8 { C0 D18E ; # small yu C1 D0B0 ; # small a C2 D0B1 ; # small b C3 D186 ; # small ts ... } Full conversion tables from C to C, and from C and C to C are provided in the distribution files Fkoi-win>, Fkoi-utf>, and Fwin-utf>. =head2 charset_types B charset_types I> ...> B Ihtml textExml textEplain textEvnd.wap.wml applicationEjavascript applicationErss+xml> B I B I B I This directive appeared in version 0.7.9. Enables module processing in responses with the specified MIME types in addition to “Chtml>”. The special value “C<*>” matches any MIME type (0.8.29). B Until version 1.5.4, “Cx-javascript>” was used as the default MIME type instead of “Cjavascript>”. =head2 override_charset B override_charset I E C> B I B I B I B I B I Determines whether a conversion should be performed for answers received from a proxied or a FastCGIEuwsgiESCGI server when the answers already carry a charset in the C response header field. If conversion is enabled, a charset specified in the received response is used as a source charset. B It should be noted that if a response is received in a subrequest then the conversion from the response charset to the main request charset is always performed, regardless of the C directive setting. =head2 source_charset B source_charset I>> B I B I B I B I Defines the source charset of a response. If this charset is different from the charset specified in the L directive, a conversion is performed.