如何制作德语网站
什么类型的编码或者我必须做什么才能使我的网站正确显示带有德语字符的文本,如下所示: Käse 而不是这样: Käse ?
这是我用于 doctype 的内容:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
这是我用于编码的内容:
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
我使用的 mysql 中的排序规则是 utf8_general_ci,除了英语(从头开始)之外,我从未用其他语言做过网站。我不知道我错过了什么!
谢谢您的宝贵时间!
what type of encoding or what do I have to do to make my web site display properly the text with German characters like this: Käse and not like this: K�se ?
Here is what I use for doctype:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
and here is what I use for encoding:
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
the collation in mysql that I use is utf8_general_ci, I have never done web sites with other languages except for english (from scratch). I dont know what I am missing!
Thank you for your time!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的编码选择看起来不错。
只剩下两个步骤:您必须确保 HTTP 标头中的内容类型也相同,并且您必须确保实际发送的内容是使用 UTF-8 编码的。
Your encoding choise looks fine.
There is just two steps left: You have to make sure that the content type in the HTTP header also says the same, and you have to make sure that what you actually send is encoded using UTF-8.
UTF-8 应该用于支持多种语言的网站,因此适合您的需求。
元标记也是正确的,尽管您可能希望确保服务器发送正确的
Content-Type
标题。确保 HTML 文件也使用 UTF-8 编码,而不是 ASCII 或其他代码页。
一般来说,需要确保从DB到浏览器的所有步骤都使用UTF-8(因此,DB列是UTF-8,传输到服务器为UTF-8,渲染为UTF-8,传输到浏览器为UTF-8 具有正确的标头和元标记)。
UTF-8 should used for sites that cater for many languages, so is suitable for your needs.
The meta tag is correct too, though you may want to ensure that the server is sending the right
Content-Type
header.Ensure that the HTML file is also encoded with UTF-8 and not ASCII or another codepage.
In general, you need to ensure that all steps from the DB to the browser use UTF-8 (so, DB columns are UTF-8, transferred to the server as UTF-8, rendered as UTF-8, transferred to the browser as UTF-8 with the right headers and meta tags).
根据我的经验,要使 utf-8 正常工作:
From my expiriense, for utf-8 to work right: