lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sun, May 25, 2008 at 7:44 PM, Peter Odding <xolox@home.nl> wrote:
> Additionally you should use a Content-Type header to let web browsers
> know what character set is used in your web pages, for example:
>
>  Content-Type: text/html; charset=utf-8
>
> If you do this properly your web application will only ever receive
> strings encoded in UTF-8 which means you won't need any conversion. An
> alternative to the header above is to use the following meta tag in your
> HTML:
>
>  <meta name="Content-Type" content="text/html; charset=utf-8">

That would be <meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />

Note that a <meta http-equiv ...> tag is _only_ used if the web server
does not send a corresponding header. It is mostly relevant if you
save the file to disk and open it in the browser from there, since
there will then be no web-server to send the headers.

Also, while it is mostly true that browsers will reply in the same
charset as the page was served with, you may want to explicitly
specify the encoding for each form in your application with <form
accept-charset="utf-8">. Usually this isn't needed though.

While it's about php, this page is one of the best explanations I've
seen on the whole charset-issue. As mentioned, Lua and php have
similar limitations/problems in this regard:
http://www.phpwact.org/php/i18n/charsets

--
troels