开发者

 trouble with IE6+UTF-8

IE has trouble with 开发者_StackOverflow#&8302;(Actual character references) be interpreted as white space with multi byte

  • OK:http://tmp.zeg.la/shift_jis.html
  • OK:http://tmp.zeg.la/euc-jp.html
  • NOT OK:http://tmp.zeg.la/utf-8.html


I don't get white space, I get squares, and it's not to do with the character references, it's just because IE can't render that character in the fonts it is trying to use.

The browser needs to know the language of the document to choose the default font to render the document in. Each language has its own default font, for example Times New Roman for Latin alphabets, or MS Gothic for Japanese. You can change the default font for a language from the browser settings.

Some browsers switch the default font based on language, so you can set it by saying lang="ja" for Japanese. Others (such as IE) switch it based on the encoding of the page, so that encodings that are normally associated with Japanese such as Shift-JIS pick up a Japanese font by default. This is somewhat unfortunate as really the encoding of the page should have nothing to do with the font, but it's heuristic in common use. Some browsers use both.

This probably wouldn't greatly matter, except that IE is notoriously poor at choosing fall-back fonts for when glyphs aren't available in the selected font. If it hasn't managed to choose a particular font for the language in the document, it may well end up with the squares. For what it's worth, I get Japanese rendered correct for all your example pages when using a real Japanese Windows install (with Japanese as the locale for the system code page), but squares on an English install with extra Japanese fonts installed.

So:

(1) mark your document as being in Japanese:

<html lang="ja">

(2) use CSS to direct IE to the Japanese fonts that most IE users are likely to have installed:

body { font-family: "Meiryo", "MS Gothic", "MS 明朝", Verdana, sans-serif; }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜