CSS以日语呈现? [英] CSS rendered in Japanese?

查看:235
本文介绍了CSS以日语呈现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

注意:我继承了此网站,我没有建立它。

Note: I inherited this site, I did not build it.

主页突然无法正常工作。它看起来像是一个CSS问题。当我进入Safari浏览器(Mac)的Web检查器,我点击打开CSS,它显示一堆看起来像日语字符。不知道会做什么。除了做一些基本的内容(HTML)更改,我从来没有做过太多的网站。他们说没有其他人也在改变。网站的其余部分使用不同的样式表,工作正常。有任何想法吗?以下是网站。提前感谢!

The home page is all the sudden not working. It looks like it's a CSS issue. When I went into the web inspector in Safari(Mac), I clicked to open the CSS and it shows a bunch of what looks like Japanese characters. No idea what would have done this. I've never done much with the site, except making some basic content(HTML) changes. They say no one else has been in making changes either. The rest of the site uses a different style sheet, and works fine. Any ideas? Here's the site. Thanks in advance!

推荐答案

问题是由HTML文档的编码引起的:它是UTF-16LE编码的。您可以看到通过在Firefox上打开它,检查应用的编码,通过视图菜单,然后通过该菜单手动更改编码为ISO-8859-1。您将看到,当解释为ISO-8859-1时,文档以ÿþ开头,它是UTF-16中的字节顺序标记。 (这将覆盖声明要对文档进行ISO-8859-1编码的 meta 标记的效果。)

The problem is caused by the encoding of the HTML document: it is UTF-16LE encoded. You can see this e.g. by opening it on Firefox, checking out the encoding being applied, via the View menu, then manually changing the encoding to ISO-8859-1, via that menu. You will see that when interpreted as ISO-8859-1, the document starts with "ÿþ", which is a byte order mark in UTF-16. (This overrides the effect of the meta tag that claims the document to be ISO-8859-1 encoded.)

由于外部CSS文件没有提供有关HTTP标头或文件内容中编码的信息,浏览器必须进行猜测。 IE正确猜测它是Ascii编码的,但其他浏览器使用HTML文档的编码。如果你采用两个Ascii字符并将它们解释为UTF-16代码单元,你通常会得到一个中文(CJK)字符。

Since the external CSS file is served by no information about encoding in HTTP headers or in the file contents, browsers will have to make a guess. IE correctly guesses that it is Ascii encoded, but other browsers use the encoding of the HTML document. If you take two Ascii characters and interpret them as on UTF-16 code unit, you mostly get a Chinese (CJK) character.

由于UTF-16通常不应该在Web上使用,修复是在编辑器中打开HTML文档,并将其保存在ISO-8859-1编码或一些类似的编码,如Windows-1252。在记事本上,例如,使用另存为并选择ANSI格式。

Since UTF-16 should generally not be used on the Web, the fix is to open the HTML document in an editor and save it in the ISO-8859-1 encoding or some similar encoding, such as windows-1252. On Notepad for example, use "Save As" and select the "ANSI" format.

这篇关于CSS以日语呈现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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