HTML encoding for spanish, working locally but not on the server [duplicate]

假如想象 提交于 2019-12-25 02:27:07

问题


I am adding spanish as a language and I'm having problems with the encoding.

All the spanish characters work perfectly locally (this makes it harder to debug):

But on the server they look this way:

I'm pretty puzzled, you can see the beta version here.

My doctype and charset are the following:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
...

Which should be correct as far as I understand.

I am using gettext for translations.

I checked and the declared encoding of the .po file is UTF-8.

I also set bind_textdomain_codeset to UTF-8.

I'm not sure where the problem is actually relying.


回答1:


Your server is set to serve pages with this Content-Type header:

Content-Type:text/html; charset=iso-8859-1

You need to tell it to serve them as charset=utf-8 instead. You can do this in PHP too:

header('Content-Type: text/html; charset=utf-8');


来源:https://stackoverflow.com/questions/20332217/html-encoding-for-spanish-working-locally-but-not-on-the-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!