用于西班牙语的HTML编码,可以在本地工作,但不能在服务器上工作 [英] HTML encoding for spanish, working locally but not on the server

查看:126
本文介绍了用于西班牙语的HTML编码,可以在本地工作,但不能在服务器上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将西班牙语添加为一种语言,但是在编码方面遇到了问题.

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.

我正在使用gettext进行翻译.

I am using gettext for translations.

我检查了一下,.po文件的声明编码为UTF-8.

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

我还将bind_textdomain_codeset设置为UTF-8.

I also set bind_textdomain_codeset to UTF-8.

我不确定问题出在哪里.

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

推荐答案

您的服务器设置为使用此Content-Type标头提供页面:

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

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

您需要告诉它将其用作charset=utf-8.您也可以在PHP中执行此操作:

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');

这篇关于用于西班牙语的HTML编码,可以在本地工作,但不能在服务器上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆