Setting Charset on Nginx PHP virtual host

Vincent M. mouseless at
Mon Aug 5 12:31:00 UTC 2019

Le 04/08/2019 à 23:57, Francis Daly a écrit :
> On Sun, Aug 04, 2019 at 03:11:36PM +0200, Vincent M. wrote:
> Hi there,
>> But the special characters was displayed with "?" not with � .
> I wonder...
> The nginx docs say """Missing characters in the range 80-FF are replaced
> with “?”. """
> Is there any chance that the response body is actually iso-8859-1,
> but the header claims that it is utf-8? In that case, you would want to
> change the header, but *not* convert the body.

The header tag for the charset has not been changed is set to "iso-8859-1":

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">

> (Strictly: you would want to fix the source, so that it does not lie
> about its content. But if you can't do that, then "just" changing the
> header in nginx may be adequate.)
>> Anyway, it's a PHP issue not Nginx. The default PHP charset config is set to
>> "utf-8" and to overwrite it, I have added on the beginning of my script:
>>      ini_set('default_charset', 'iso-8859-1');
>> And it's working fine...
> Great that you have an overall configuration that works for you.
Yes, it's an old website for which I don't want to loose too many time.
> Cheers,
> 	f

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

More information about the nginx mailing list