将iso-8859-1显示德国umlauts确定还是我需要使用utf-8? [英] Will iso-8859-1 display german umlauts ok or do I need to use utf-8?

查看:130
本文介绍了将iso-8859-1显示德国umlauts确定还是我需要使用utf-8?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个多语言网站托管在服务器上,似乎有字符编码设置为默认为iso-8859-1。



我以为我最好拥有页面utf-8并包含元标记来声明这一点。不幸的是,这个元标记似乎被覆盖,页面默认为iso-8859。



德语和荷兰语页面中的许多特殊字符都无法正确显示。



我需要尝试更改服务器默认为utf-8或什么?也许我可以删除服务器默认完全?嗯...真的不知道这里最好做什么。



任何建议都会很棒!

解决方案

当通过HTTP提供HTML页面时,不会使用内容类型的HTML元标记。相反,将使用HTTP响应中的内容类型标头。您可以在面板中确定内容类型标题,例如





如果您无法更改HTTP响应标头,则必须提供有关编程的更多详细信息语言和网络服务器。这样我们可以给你更合适的答案。



如果你想坚持ISO-8859-1,那么你需要确保你的页面保存为ISO-8859-1,而不是UTF- 8。否则,当您将以UTF-8格式保存的资源显示为ISO-8859时,某些字符可能会 mojibake -1。


I have a multi language website that is hosted on a server that appears to have character encoding set to default to iso-8859-1.

I thought I would be best having the pages utf-8 and included a meta tag to declare this. Unfortunately this meta tag seems to get overridden and the page defaults to iso-8859.

Many special characters in the German and Dutch pages are not showing correctly.

Do I need to try and change the server default to utf-8 or something? Maybe I could remove the server default completly? Hmm... really not sure what's best to do here.

Any advice would be great!

解决方案

The HTML meta tags for the content type are not used when the HTML page is served over HTTP. Instead, the content type header in the HTTP response will be used. You can determine the content type header with for example Firebug, in the Net panel.

How to change this depends on the programming language and/or the webserver which you are using, which is unclear from your current question. As per you question history, you seem to be using PHP. In that case, you need to add the following line to the PHP file, before you emit any character to the response.

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

See also:


If you're unable to change the HTTP response header, you have to give more detail about the programming language and webserver which you're using. This way we can give you better suited answers.

If you want to stick to ISO-8859-1, then you need to ensure that your pages are saved as ISO-8859-1 as well instead of as UTF-8. Otherwise some characters may indeed go mojibake when you display a UTF-8 saved resource as ISO-8859-1.

这篇关于将iso-8859-1显示德国umlauts确定还是我需要使用utf-8?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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