lighttpd forum lighty > Serving utf-8 files with lighttpd

Posted by Sérgio Nunes (Guest)
on 14.07.2008 17:05
Hi,

I have a Ubuntu Gutsy installation with lighttpd + php5 installed (via 
aptitude) and running. Everything seems to be working just fine for 
Latin1 files.

However I am having troubles serving UTF-8 files.
On Apache, the "AddDefaultCharset" directive would probably handle this 
problem.

Is there a similar directive in lighttpd?
What should I do to get lighttpd serving UTF-8 encoded files?

Thanks in advance for any comments,
--
Sérgio Nunes
Posted by Jay Rabbit
on 14.07.2008 17:29
Sérgio Nunes wrote:
> Hi,
> 
> I have a Ubuntu Gutsy installation with lighttpd + php5 installed (via 
> aptitude) and running. Everything seems to be working just fine for 
> Latin1 files.
> 
> However I am having troubles serving UTF-8 files.
> On Apache, the "AddDefaultCharset" directive would probably handle this 
> problem.
> 
> Is there a similar directive in lighttpd?
> What should I do to get lighttpd serving UTF-8 encoded files?
> 
> Thanks in advance for any comments,
> --
> Sérgio Nunes

Use mod_headers to to add a content encoding header (see the HTTP/1.1 
specification on headers at w3.org for details). If the UTF-8 is php 
generated, it would be better to do this inside your PHP scripts instead 
as the less web-server config, the better.
Posted by Jason Young
on 15.07.2008 03:38
Yeah, if most of your content is PHP-served, check the 'default_charset' 
directive in PHP.ini. Here's mine:

default_mimetype = "text/html"
default_charset = "utf-8"