Chrome doesn't display special character while other browsers do

前端 未结 3 817
滥情空心
滥情空心 2021-01-17 13:21

I am trying to display character code in a breadcrumb trail navigation which forms this arrow: ❯

It displays properly in Firefox, Op

相关标签:
3条回答
  • 2021-01-17 13:43

    Have you tried to use

    htmlspecialchars(string)

    or

    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-8">

    0 讨论(0)
  • 2021-01-17 13:50

    This is almost a duplicate of Can't display character on IE 9, but since that question is specifically about IE and this one is about Chrome, I’ll copy the answer, with modifications, here:

    Browsers (including Chrome) sometimes have difficulties in rendering a character when it does not exist in the fonts specified for an element or, in the absence of such specifications, in the browser’s default font. Browsers should check all the fonts in the system to find out one that contains the character, but sometimes they fail to do that. Sometimes the reason is that some font has information that claims that it has a glyph for the character (so the browser stops searching) but hasn’t.

    The cure is to specify a list of fonts know to contain the character. For “❯” U+276F HEAVY RIGHT-POINTING ANGLE QUOTATION MARK ORNAMENT (a rather special character), font coverage is very limited. Most computers have no font containing it. You can specify a font list like the following:

     font-family: DejaVu Sans, Symbola, Everson Mono, Dingbats, Segoe UI Symbol,
     Quivira, SunExt-A, FreeSerif, Universalia, unifont;
    

    But most users lack all of these fonts. You might consider using a downloadable font (web font) with @font-face. DejaVu fonts, Symbola, and Quivira are free fonts, though they are rather large in file size.

    Alternatively, consider using an image. This character is an ornamental dingbat, a special graphic rather than a character, though for legacy reasons it has been encoded as a character in Unicode.

    More info: Guide to using special characters in HTML.

    0 讨论(0)
  • 2021-01-17 13:51

    [Edit] Apparently, it's a known problem for UTF-16, not UTF-8. [/EDIT]

    It's a known problem. The simplest fallback is to use a Unicode surrogate pair.

    [sources]

    http://www.fileformat.info/info/unicode/char/10095/index.htm

    http://mathiasbynens.be/notes/javascript-unicode

    0 讨论(0)
提交回复
热议问题