html - 在我的网页上使用 UTF-8 字符(如 ✖)是否安全?

标签 html utf-8 fonts

我想在我的网站上使用 UTF-8 字符 ✖,但我不确定是否支持跨浏览器。

我担心:

a) 用户将无法访问包含该字符的字体

b) 即使用户有可以显示它的字体,IE 也不会找到该字符。因为这个信息,我很担心这个:

By the specifications, browsers should display a character if there is any font in the system that contains it. If the fonts specified by the author (in CSS font-family settings or, rarely these days, using font markup in HTML) do not contain the character, browsers are sup­posed to use fallback fonts. The same applies if no fonts are specified by the author; brows­ers should use primarily their default fonts, using alternate fonts for any character not covered by the primary font.

In practice, things don’t always work that way. Especially IE is notorious for its failures in this respect. It often fails to display a character, even though it could do that if it used all the fonts in the system. If a browser cannot render a character, it may show a small rectangle, possibly containing a question mark, ?, or some similar indicator. Here’s a quick test (char­ac­ter U+0840, which is probably not supported by any font on your computer): ࡀ.

Source .

c) 我想到的其他问题。

有一个名为 Unify 的资源, 这将显示支持该字符的设备,但目前(2015 年 9 月 14 日)仅支持 107 个字符。


总而言之,问题是:如何确定在我的网站上使用 utf-8 特殊字符是否安全?专门在我的网站上使用 ✖ 安全吗?

最佳答案

它始终安全 - 您用户的计算机不会突然起火。

从技术角度来看,您最好的选择是使用支持您要使用的每个 Unicode 字符的网络字体。这不是万能的(用户可能禁用了网络字体或正在使用命令行浏览器等),但它应该支持绝大多数计算机。

从那里我会应用常识。如果一个字符的显示是绝对重要的并且生命取决于它,那么尽量不要使用 Unicode。否则我会说“继续”。

关于html - 在我的网页上使用 UTF-8 字符(如 ✖)是否安全?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32572369/

相关文章:

haskell - Haskell 中的简单 RSS 下载器

css - 在 weebly 博客上使用自定义字体

Android:外部网站和 CSS 使用自定义字体 (Arial) 的 WebView

javascript - 为什么 DOMParser 不保留已解析 DOM 的内联样式?

html - 表格列 - 首先使用最大宽度,其他宽度最小

php - HTML div 截图?

iphone - UTF-8 字符问题(iOS、NSString)

html - css sidebar positioning with a margin 不断下沉

mysql - 在 utf-8 中从 bash 写入 Mysql DB

css - 在 Wordpress 中使用谷歌字体