2012-01-20 65 views
1

我正在設計一個網站(www.lathamcity.com),我使用Unicode字符&#x2022來表示我的標題中的一個項目符號點。但是,當我在IE9中加載頁面時,項目符號點不會顯示,而代替該字符的Unicode。IE9:如何使Unicode字符正確顯示?

我的字符集的HTML文檔中定義與

<meta charset="UTF-8"> 

和用於報頭的代碼是

<td id="infoCell" class="header"> 
     <a href="/resume.pdf" class="header" target="_blank">R&#233sum&#233</a> 
     &nbsp &#x2022 &nbsp 
     <a href="mailto:[email protected]" class="header" target="_blank">E-mail</a> 
     &nbsp &#x2022 &nbsp 
     <a href="https://github.com/orthogonal/" class="header" target="_blank">GitHub</a> 
     &nbsp &#x2022 &nbsp 
     <a href="http://stackoverflow.com/users/1146679/andrew-latham" class="header" target="_blank">StackOverflow</a> 
     &nbsp &#x2022 &nbsp 
     <a href="http://main.uschess.org/assets/msa_joomla/MbrDtlMain.php?12842311" class="header" target="_blank">USCF</a> 
    </td> 

字符在鉻和Firefox正確顯示。我做錯了什麼,爲什麼會發生,我該如何解決?

回答

3

您錯過了一個分號。

&#x2022 

應該是

&#x2022; 

同樣,&nbsp&#233應以;結束。

HTML5 spec說:

Hexadecimal numeric character reference

The ampersand must be followed by a U+0023 NUMBER SIGN character (#), which must be followed by either a U+0078 LATIN SMALL LETTER X character (x) or a U+0058 LATIN CAPITAL LETTER X character (X), which must then be followed by one or more digits in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), U+0061 LATIN SMALL LETTER A to U+0066 LATIN SMALL LETTER F, and U+0041 LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F, representing a base-sixteen integer that corresponds to a Unicode code point that is allowed according to the definition below. The digits must then be followed by a U+003B SEMICOLON character (;).

+0

這是IE 9(在Quirks模式)的錯誤,因爲由spefications,'&#x2022'此處是有效的。但是一直以來都是很好的做法,推薦使用分號結束所有實體引用(如' ')和字符引用(如'é'),部分原因是忽略它引發了各種瀏覽器錯誤。 –

+0

@ JukkaK.Korpela,哪個規範?我對[ambiguous&符號](http://www.w3.org/TR/html5/syntax.html#syntax-ambiguous-ampersand)部分的解讀是,雖然RCDATA以外的可恢復屬性值,屬性值,和外國元素。 –

+1

@ JukkaK.Korpela這在SGML中可能是真的,但HTML5不是SGML,我很遺憾地說。順便說一句,跟一個空格是好的,但我很肯定,跟一封信(如第一行)一樣,即使使用SGML也是不可能的! –