Setting Charset on Nginx PHP virtual host

Vincent M. mouseless at
Fri Aug 2 13:11:05 UTC 2019

Hello Francis,

You are right, the charset map is missing and specified in the nginx log 
error file:

/2019/08/02 12:53:42 [error] 19151#19151: *28013 no "charset_map" 
between the charsets "UTF-8" and "iso-8859-1" while reading response 
header from upstream, client: .../

I have found 3 charset maps in my nginx default install, but none for 
iso-8859-1 to utf8 conversion:
koi-utf, koi-win, win-utf

So I tried in http with empty charset_map:
         charset_map iso-8859-1 utf-8 { }
But special characters like é are displayed with ?

Where to find a charset_map?

Thank you for your help,

Le 01/08/2019 à 22:07, Francis Daly a écrit :
> On Wed, Jul 31, 2019 at 05:29:37PM +0200, Vincent M. wrote:
> Hi there,
>> I have specified charset and overried_charset on both server and location
>> and yet, it was still sending headers in UTF-8.
> What does the error log say?
> Is there something like
>    no "charset_map" between the charsets "utf-8" and "iso-8859-1" while reading response header from upstream
> there? Because that could explain why the conversion does not happen.
>> On Apache we can do:
>> <VirtualHost>
>> ...
>>      Header set Content-Type "text/html; charset=iso-8859-1"
>> </VirtualHost>
>> How to do the same on Nginx?
> I think that that Apache config will set the Content-Type header
> on responses it sends; but will not do anything to actually make the
> response body be valid iso-8859-1.
> The nginx "charset" module expects to modify the response body if
> necessary.
> You can try adding a charset_map ( --
> either a full one that maps between the one-byte iso-8859-1 values and
> utf-8 values that differ; or just an empty one and let the &# conversion
> happen instead.
>    charset_map iso-8859-1 utf-8 { }
> or include extra pieces like
> if you want explicit conversion.
> 	f

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list