XHTML5和HTML4字符实体 [英] XHTML5 and HTML4 character entities

查看:126
本文介绍了XHTML5和HTML4字符实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

XHTML5支持字符实体,如& nbsp; & mdash; 。在工作中,我们可能需要特定的软件才能访问网站的管理员端,而且人们要求多文件上传。对我来说,这是一个很容易的理由,需要迁移到FF 3.6 +,所以我会尽快做到这一点。我们目前使用XHTML 1.1,并且在转向HTML5时,我仅 与字符实体名称存在问题......有没有人有关于此的文档?



我看到 WHATWG 规范,但我不确定它是否会影响用作 application / xhtml + xml 的文件。无论如何,在Chromium nightly和FF 3.6中都提到了两个触发错误。

解决方案

正确答案(现代方式)



五年前我问过这个问题。现在,每个浏览器都支持UTF-8。而且,UTF-8的每一次启动都包含了对所有所有命名字符实体的字形支持。目前解决这个问题的最正确的办法是根本不使用命名实体,而是仅为UTF-8(严格)提供字符并实际使用字符。

这是所有XML实体的列表。所有这些都有UTF-8字符的替代品 - 这就是他们通常会被渲染的方式。



例如,采取

  U + 1D6D8,MATHEMATICAL BOLD SMALL CHI,b.chi 

我想在xml的一些变体中,您可以有& b.chi 或其他东西,搜索 MATHEMATICAL BOLD SMALL CHI 您会发现 fileformat.info上的某些页面,它有

Does XHTML5 support character entities such as   and —. At work we can require specific software to access the admin side of the site, and people are demanding multi-file-upload. For me this is an easy justification to require migrating to FF 3.6+, so I'll be doing it soonish. We currently use XHTML 1.1, and upon moving to HTML5, I'm only having issues with character entity names... Does anyone have a doc on this?

I see there is a list on the WHATWG spec but I'm not sure if it affects files served as application/xhtml+xml. By any means the two mentioned trigger errors in both Chromium nightly and FF 3.6.

解决方案

The right answer (the modern way)

I asked this question five years ago. Now every browser supports UTF-8. And, every inception of UTF-8 includes glyph support for all named character entities. The rightmost current solution to this problem is not to use named entities at all but to serve only UTF-8 (strict) and to use actually characters in that.

This is a list of all XML entities. All of these have UTF-8 character alternatives -- and that's how they'd normally be rendered anyway.

For instance, take

U+1D6D8, MATHEMATICAL BOLD SMALL CHI            , b.chi

I suppose in some variant of xml you could have &b.chi or something, searching for MATHEMATICAL BOLD SMALL CHI you'll find some page on fileformat.info, which has the

这篇关于XHTML5和HTML4字符实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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