FAQ

Page Discussion History

Difference between revisions of "HttpCharsetModule"

(Directives)
(One intermediate revision by one user not shown)
Line 1: Line 1:
 
<!-- page was renamed from NginxDocsEnglishDraftHttpCharsetModule
 
<!-- page was renamed from NginxDocsEnglishDraftHttpCharsetModule
 
-->
 
-->
 +
 +
<span style="color:red">WARNING: this article is obsoleted. Please refer to http://nginx.org/en/docs/ for the latest official documentation.</span>
 +
 
= Synopsis =
 
= Synopsis =
  
Line 17: Line 20:
  
 
== charset ==
 
== charset ==
<include wikitext nopre src="http://wiki.nginx.org/nginx.org/ngx_http_charset_module/charset.txt" />
+
<include wikitext nopre src="http://wiki.nginx.org/nginx.org/http/ngx_http_charset_module/charset.txt" />
  
 
The directive charset adds the line "Content-Type" into response-header with indicated encoding.
 
The directive charset adds the line "Content-Type" into response-header with indicated encoding.
Line 25: Line 28:
  
 
== charset_map ==
 
== charset_map ==
<include wikitext nopre src="http://wiki.nginx.org/nginx.org/ngx_http_charset_module/charset_map.txt" />
+
<include wikitext nopre src="http://wiki.nginx.org/nginx.org/http/ngx_http_charset_module/charset_map.txt" />
  
 
The directive charset_map describes the table of reencoding from one encoding into another.
 
The directive charset_map describes the table of reencoding from one encoding into another.
Line 46: Line 49:
  
 
== charset_types ==
 
== charset_types ==
<include wikitext nopre src="http://wiki.nginx.org/nginx.org/ngx_http_charset_module/charset_types.txt" />
+
<include wikitext nopre src="http://wiki.nginx.org/nginx.org/http/ngx_http_charset_module/charset_types.txt" />
  
 
== override_charset ==
 
== override_charset ==
<include wikitext nopre src="http://wiki.nginx.org/nginx.org/ngx_http_charset_module/override_charset.txt" />
+
<include wikitext nopre src="http://wiki.nginx.org/nginx.org/http/ngx_http_charset_module/override_charset.txt" />
  
 
This directive determines, to carry out reencoding for the response, obtained from the proxied
 
This directive determines, to carry out reencoding for the response, obtained from the proxied
Line 59: Line 62:
  
 
== source_charset ==
 
== source_charset ==
<include wikitext nopre src="http://wiki.nginx.org/nginx.org/ngx_http_charset_module/source_charset.txt" />
+
<include wikitext nopre src="http://wiki.nginx.org/nginx.org/http/ngx_http_charset_module/source_charset.txt" />
  
 
The directive source_charset assigns the initial encoding of response. If this encoding is differed from that
 
The directive source_charset assigns the initial encoding of response. If this encoding is differed from that

Revision as of 21:35, 22 August 2013


WARNING: this article is obsoleted. Please refer to http://nginx.org/en/docs/ for the latest official documentation.

Contents

Synopsis

This module adds the text encoding to the "Content-Type indicated" response-header.

Furthermore, module can reencode data of one encoding into another. It is necessary to note that the reencoding is accomplished only in one direction - from the server to the client, and only one-byte encodings can be reencoded.

Example configuration:

charset         windows-1251;
source_charset  koi8-r;

Directives

charset

Syntax: charset charset | off
Default: off
Context: http
server
location
if in location
Reference:charset


The directive charset adds the line "Content-Type" into response-header with indicated encoding. If this encoding is differed from that indicated in directive source_charset, then reencoding is carried out. The parameter "off" deactivate the insertation of the line "Content-Type" in the response-header.


charset_map

Syntax: charset_map charset1 charset2 { ... }
Default:
Context: http
Reference:charset_map


The directive charset_map describes the table of reencoding from one encoding into another. A table for the inverse reencoding is created using the same data. The codes of symbols are assigned in hexadecimal form. If no recorded symbols are in the range 80-FF they will be substituted with '?'.

Example usage:

charset_map  koi8-r  windows-1251 {
  C0  FE ; # small yu
  C1  E0 ; # small a
  C2  E1 ; # small b
  C3  F6 ; # small ts
  # ...
}

The complete table of conversion from koi8-r into Windows-1251 is distributed with nginx and is located in file conf/koi-win.

charset_types

Syntax: charset_types mime-type ...
Default: text/html text/xml text/plain text/vnd.wap.wml application/x-javascript application/rss+xml
Context: http
server
location
Appeared in: 0.7.9
Reference:charset_types


override_charset

Syntax: override_charset on | off
Default: off
Context: http
server
location
if in location
Reference:override_charset


This directive determines, to carry out reencoding for the response, obtained from the proxied server or from FastCGI-server, if in the response-header a "Content-Type" header already is. If reencoding is permitted, then as the initial encoding the encoding, indicated in the obtained answer, is used.

It is necessary to note that if the response was obtained in the subquery then, independent of directive override_charset, is always carried out reencoding from encoding of the response into encoding of basic demand.

source_charset

Syntax: source_charset charset
Default:
Context: http
server
location
if in location
Reference:source_charset


The directive source_charset assigns the initial encoding of response. If this encoding is differed from that indicated in directive charset, then reencoding is carried out.

References

Original Documentation