HTML encoding for spanish, working locally but not

2019-09-06 09:08发布

This question already has an answer here:

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):

enter image description here

But on the server they look this way:

enter image description here

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条回答
倾城 Initia
2楼-- · 2019-09-06 10:03

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');
查看更多
登录 后发表回答