http-iconv #

Character-set conversion filter — re-encode response bodies between arbitrary charsets (e.g. GBK ↔ UTF-8) via libiconv at the filter stage.

Source: upstream source

Directives

iconv_buffer_size #

syntax: iconv_buffer_size 1 arg (size (k/m/g));  ·  context: location

Size in bytes; accepts k / m / g suffixes.

iconv_filter #

syntax: iconv_filter 2 args;  ·  context: location

Converts response body content generated within a location from one character encoding to another as an output filter.

set_iconv #

syntax: set_iconv 4 args;  ·  context: location

It brings the 'set_iconv' command to nginx.

Example


 #nginx.conf

 location /foo {
     set $src '你好'; #in UTF-8
     set_iconv $dst $src from=utf8 to=gbk; #now $dst holds 你好 in GBK
 }

 #everything generated from /foo will be converted from utf8 to gbk
 location /bar {
     iconv_filter from=utf-8 to=gbk;
     iconv_buffer_size 1k;
     #content handler here
 }

↑ back to index