/
649.txt
194 lines (140 loc) · 13.1 KB
/
649.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
* HTML 文字参照 XML DTD
[85] [[Firefox]] では、[[システム識別子]]が[[絶対URL]]でないと ([[URL scheme]] が含まれていないと)
[[公開識別子]]が[[文字参照]]の [[DTD]] のものだとしても、無視されるようです。
[[Chrome]] ではそのようなことはありません。 [TIME[2014-03-02T05:25:20.500Z]]
* メモ
[9]
>
:(275) 文字参照 (character reference):
1[[文字]]に[[置換]]される[[参照]]。
[SRC[[[JIS X 4151]]-1992 3.]]
- 備考 [[名前指定文字参照]]及び[[数値指定文字参照]]の2種類がある。
[1] 【[[SGML]]】 SGML の[DFN[文字参照]]には、[[数値指定文字参照]]と[[名前指定文字参照]]があります。
前者は[[文書文字集合]]における[[文字番号]]を使って文字を参照します。例えば [CODE(SGML)[!]] は、文字番号 [CODE(SGML)[33]] の文字 [WEAK[([[ISO/IEC 646]]:1991 [[IRV]] では [CODE[!]]。)]]
を表します。後者は[[機能文字]]又は [[SGML宣言]]の[[具象構文]]の追加機能に指定してある文字を、その名前を使って参照します。
たとえば、 [SAMP(SGML)[&#RE]] は機能文字 [CODE(SGML)[[[RE]]]]
[WEAK[([[記録終了]])]] を表します。
Web SGML では、更に[[16進文字参照]]が追加されました。
[2] これに類したものとして、[[文字実体参照]]があります。
これは、[[文字]]1文字 [WEAK[(と判断されるもの。)]]
だけの[[一般実体]]を参照するものです。例えば、
[SAMP(SGML)[Á]] は[[アキュート・アクセント]]つきの文字
[SAMP[A]] に置換されるかもしれません。
(ちなみに、「[[文字実体]]」・「文字[[実体集合]]」
という言葉は SGML には出てきますが、
「文字実体参照」という言葉は [[HTML4]] で出てきます。
[WEAK[(という話は言葉遊びみたいなものですが。)]])
[3] 文字参照は、その文字が他の手段で簡便に書けない場合に限って使うことが望ましいとされています。
([[JISX4151]]‐1992 8.5 参照。)
[7]
- [CODE(ABNF)[[DFN[文字参照]] := [[名前指定文字参照]] / [[数値文字参照]] / [[16進文字参照]] ;; Web SGML [62] ]]
- [4] 文字参照の文字番号の上限ってあるのかなあ?と思って読み返してみたけどわかんなかった。ないのかなあ。もっとも、文書文字集合の最後の数より大きいのを指定してもどうせエラーになるんだろうから意味はないんだけどさあ。
- [5] どうして >>4 みたいなことを考えたかというと、[[規格参照具象構文]]の文書文字集合は 0〜127 までしか定義してないのに、[[回避文字]]に 128〜255 が載ってるの。だから 128〜255 は回避文字になって、[[非SGML文字]]にもなる。非 SGML 文字を数値指定文字参照できるんだから、以下略。って。じゃあそれなら、一切言及のない 256 以上の値だったらどうなんだ、って疑問がわいてくる。[WEAK[もっとも、 SGML 考えた連中はせいぜい 255 までしか頭になかったんだろう。]]
[6] 文字参照を使うと良い場面 (JIS 参考3 7.2 参照。) :
- 入力装置の鍵盤に対応するものがない文字
- 表示できない文字
- [[非SGML文字]]
- [[機能文字]]になっているがデータとして使いたい文字
など。
- [8] [[HTML4]] の文字参照についてイの規定 <IW:HTML4:charset.html#spec-char-encoding> によれば、 HTML では、文字参照は (1) 数値文字参照 : 10進または16進 (2) [[文字実体参照]]の2つの形で現れるとされています。一見 SGML の定義とは異なるように思えますが、 (規定中でわざわざ「SGML 文字参照」と言っていることを見ても) そうではなく、文字実体参照は文字参照を値に持つ実体であることを考えれば矛盾はないことが分かります。
[10]
[[Firefox]] 2.0 で [CODE(char)[[[U+10FFFF]]]] より大きな[[16進数]]を指定すると、値によって:
[CODE(char)[[[U-7FFFFFFF]]]] までなら[[サロゲート・ペア]]への変換の計算を拡張したらしき2[[文字]]の列になります。
;; <http://software.hixie.ch/utilities/js/live-dom-viewer/?%3Cbody%3E%0A%3Cp%3E%26%23x110000%3B%3C%2Fp%3E%0A%3Cscript%3E%0A%20%20var%20pv%20%3D%20document.getElementsByTagName%20('p')%5B0%5D.firstChild.data%3B%0A%20%20if%20(pv%20%3D%3D%20%22%5CuFFFD%22)%20%7B%0A%20%20%20%20document.write%20('%3Cp%20id%3Dresult%20class%3DPASS%3EPASS%3C%2Fp%3E')%3B%0A%20%20%7D%20else%20%7B%0A%20%20%20%20document.write%20('%3Cp%20id%3Dresult%20class%3DFAIL%3EFAIL%20(')%3B%0A%20%20%20%20for%20(var%20i%20%3D%200%3B%20i%20%3C%20pv.length%3B%20i%2B%2B)%20%7B%0A%20%20%20%20%20%20document.write%20(pv.charCodeAt%20(i).toString%20(16)%20%2B%20'%2C')%3B%0A%20%20%20%20%7D%0A%20%20%20%20document.write%20(')%3C%2Fp%3E')%3B%0A%20%20%7D%0A%3C%2Fscript%3E%3Cnoscript%3E%3Cp%20id%3Dtest%20class%3DFAIL%3EFAIL%20(noscript)%3C%2Fp%3E%3C%2Fnoscript%3E%0A>,
<http://software.hixie.ch/utilities/js/live-dom-viewer/?%3Cbody%3E%0A%3Cp%3E%26%23x7fffffff%3B%3C%2Fp%3E%0A%3Cscript%3E%0A%20%20var%20pv%20%3D%20document.getElementsByTagName%20('p')%5B0%5D.firstChild.data%3B%0A%20%20if%20(pv%20%3D%3D%20%22%5CuFFFD%22)%20%7B%0A%20%20%20%20document.write%20('%3Cp%20id%3Dresult%20class%3DPASS%3EPASS%3C%2Fp%3E')%3B%0A%20%20%7D%20else%20%7B%0A%20%20%20%20document.write%20('%3Cp%20id%3Dresult%20class%3DFAIL%3EFAIL%20(')%3B%0A%20%20%20%20for%20(var%20i%20%3D%200%3B%20i%20%3C%20pv.length%3B%20i%2B%2B)%20%7B%0A%20%20%20%20%20%20document.write%20(pv.charCodeAt%20(i).toString%20(16)%20%2B%20'%2C')%3B%0A%20%20%20%20%7D%0A%20%20%20%20document.write%20(')%3C%2Fp%3E')%3B%0A%20%20%7D%0A%3C%2Fscript%3E%3Cnoscript%3E%3Cp%20id%3Dtest%20class%3DFAIL%3EFAIL%20(noscript)%3C%2Fp%3E%3C%2Fnoscript%3E%0A>
[CODE(char)[[[0x80000000]]]]〜[CODE(char)[[[0xFFFFFFFF]]]]
だと、 [CODE(char)[[[&]]]] を除く[[文字列]]がそのまま[[文字データ]]として解釈されます。
;; <http://software.hixie.ch/utilities/js/live-dom-viewer/?%3Cbody%3E%0A%3Cp%3E%26%23x80000000%3B%3C%2Fp%3E%0A%3Cscript%3E%0A%20%20var%20pv%20%3D%20document.getElementsByTagName%20('p')%5B0%5D.firstChild.data%3B%0A%20%20if%20(pv%20%3D%3D%20%22%5CuFFFD%22)%20%7B%0A%20%20%20%20document.write%20('%3Cp%20id%3Dresult%20class%3DPASS%3EPASS%3C%2Fp%3E')%3B%0A%20%20%7D%20else%20%7B%0A%20%20%20%20document.write%20('%3Cp%20id%3Dresult%20class%3DFAIL%3EFAIL%20(')%3B%0A%20%20%20%20for%20(var%20i%20%3D%200%3B%20i%20%3C%20pv.length%3B%20i%2B%2B)%20%7B%0A%20%20%20%20%20%20document.write%20(pv.charCodeAt%20(i).toString%20(16)%20%2B%20'%2C')%3B%0A%20%20%20%20%7D%0A%20%20%20%20document.write%20(')%3C%2Fp%3E')%3B%0A%20%20%7D%0A%3C%2Fscript%3E%3Cnoscript%3E%3Cp%20id%3Dtest%20class%3DFAIL%3EFAIL%20(noscript)%3C%2Fp%3E%3C%2Fnoscript%3E%0A>
[CODE(char)[0x100000000]] 以上だと、下位8桁 (32ビット) 以外は無視されます。
;;
<http://software.hixie.ch/utilities/js/live-dom-viewer/?%3Cbody%3E%0A%3Cp%3E%26%23x100000000%3B%3C%2Fp%3E%0A%3Cscript%3E%0A%20%20var%20pv%20%3D%20document.getElementsByTagName%20('p')%5B0%5D.firstChild.data%3B%0A%20%20if%20(pv%20%3D%3D%20%22%5CuFFFD%22)%20%7B%0A%20%20%20%20document.write%20('%3Cp%20id%3Dresult%20class%3DPASS%3EPASS%3C%2Fp%3E')%3B%0A%20%20%7D%20else%20%7B%0A%20%20%20%20document.write%20('%3Cp%20id%3Dresult%20class%3DFAIL%3EFAIL%20(')%3B%0A%20%20%20%20for%20(var%20i%20%3D%200%3B%20i%20%3C%20pv.length%3B%20i%2B%2B)%20%7B%0A%20%20%20%20%20%20document.write%20(pv.charCodeAt%20(i).toString%20(16)%20%2B%20'%2C')%3B%0A%20%20%20%20%7D%0A%20%20%20%20document.write%20(')%3C%2Fp%3E')%3B%0A%20%20%7D%0A%3C%2Fscript%3E%3Cnoscript%3E%3Cp%20id%3Dtest%20class%3DFAIL%3EFAIL%20(noscript)%3C%2Fp%3E%3C%2Fnoscript%3E%0A>
[11]
>>10 [[WinIE 6]] は∀ [CODE(char)[[[U+003F]]]] になるようです。
([[名無しさん]])
[12]
>>10 [[Opera]] 9 は:
[CODE(char)[[[U-00110000]]]]〜[CODE(char)[[[0xFFFFFFFF]]]]
は[[サロゲート・ペア]]風のなにか ([[Firefox]] とは違います。)
になります。
[CODE(char)[[[0xFFFFFFFF]]]] 以上は
[CODE(char)[[[0xFFFFFFFF]]]] と同じ結果になります。
([[名無しさん]])
[13]
>>10-12 いずれも[[文字長]]の制限はないように見えます。
([[名無しさん]])
[14]
[CITE@en[XML Entity definitions for Characters]] ([CODE[2008-07-21 22:50:47 +09:00]] 版) <http://www.w3.org/TR/2008/WD-xml-entity-names-20080721/>
([[名無しさん]])
[15]
[CITE[Bug 4948 - Incorrect HTML entity error recovery doesn't match other browsers]] ([TIME[2008-07-31 09:44:14 +09:00]] 版) <https://bugs.webkit.org/show_bug.cgi?id=4948>
[63] [CITE@en[MAMA: Character entities - Opera Developer Community]] ([TIME[2008-11-25 20:22:30 +09:00]] 版) <http://dev.opera.com/articles/view/mama-character-entities/>
[64] [CITE[Business::PayPal::API - PayPal API - search.cpan.org]]
([TIME[2009-07-29 15:59:31 +09:00]] 版)
<http://search.cpan.org/~scottw/Business-PayPal-API-0.62/lib/Business/PayPal/API.pm#PayPal_Munging_URLs>
[65] [CITE@en[XML Entity Definitions for Characters]]
([TIME[2010-02-11 23:56:43 +09:00]] 版)
<http://www.w3.org/TR/2010/PR-xml-entity-names-20100211/>
[66] [CITE[Bug 9207 – Anything else: This part of the spec is problematic, for example, a query string variable &lang_id=1 in as part of an attribute of say an img tag, will get converted into an character token when it shouldn't be. Why is the set of characters a-z, A-Z, 0-]]
([TIME[2010-04-03 12:54:02 +09:00]] 版)
<http://www.w3.org/Bugs/Public/show_bug.cgi>
[67] [CITE@en[HTML5 Revision Tracker]]
([TIME[2010-04-03 12:53:38 +09:00]] 版)
<http://html5.org/tools/web-apps-tracker?from=4958&to=4959>
[68] [CITE@en[XML Entity Definitions for Characters]]
([TIME[2010-04-02 02:35:33 +09:00]] 版)
<http://www.w3.org/TR/2010/REC-xml-entity-names-20100401/>
[69] [CITE[IRC logs: freenode / #whatwg / 20100403]]
([TIME[2010-04-18 19:51:34 +09:00]] 版)
<http://krijnhoetmer.nl/irc-logs/whatwg/20100403#l-73>
[70] [CITE[Bug 10067 – this only lists entities whose replacement text is a single character, for example many of the negated operators, for example]]
( ([TIME[2010-10-09 19:15:18 +09:00]] 版))
<http://www.w3.org/Bugs/Public/show_bug.cgi?id=10067>
[71] [CITE[IRC logs: freenode / #whatwg / 20100927]]
( ([TIME[2010-10-10 13:19:34 +09:00]] 版))
<http://krijnhoetmer.nl/irc-logs/whatwg/20100927>
[72] [CITE@EN[XQuery 1.0: An XML Query Language (Second Edition)]]
( ([TIME[2011-01-05 01:29:08 +09:00]] 版))
<http://www.w3.org/TR/2010/REC-xquery-20101214/#dt-predefined-entity-reference>
[73] [CITE@EN[XQuery 1.0: An XML Query Language (Second Edition)]]
( ([TIME[2011-01-05 01:29:08 +09:00]] 版))
<http://www.w3.org/TR/2010/REC-xquery-20101214/#dt-character-reference>
[74] [CITE[IRC logs: freenode / #whatwg / 20120525]]
( ([TIME[2012-06-03 11:15:18 +09:00]] 版))
<http://krijnhoetmer.nl/irc-logs/whatwg/20120525#l-480>
[75] [CITE@en[Web Applications 1.0 r7133 Add a JSON file for entities for convenience.]]
( ([TIME[2012-06-15 04:11:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=7132&to=7133>
[76] [CITE@en[Public Identifiers for entity resolution in XHTML]]
( ([TIME[2013-01-16 08:18:42 +09:00]] 版))
<http://www.w3.org/2003/entities/2007doc/xhtmlpubid.html>
[77] [CITE[''''''[''''''whatwg'''''']'''''' Entity definitions in XHTML]]
( ([TIME[2013-01-17 18:58:07 +09:00]] 版))
<http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-January/038707.html>
[78] [CITE[Additional named entities for HTML]]
( ([TIME[2000-03-13 23:37:21 +09:00]] 版))
<http://www.w3.org/TR/WD-entities-961125>
[79] [CITE@en[Web Applications 1.0 r7679 Make <a href='?guitar=2&=1&pedal=6'> a parse error since IE9 misparses it '?guitar=2&=1&pedal=6' apparently.]]
( ([TIME[2013-01-31 09:36:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=7678&to=7679>
[80] [CITE@en[Public Identifiers for entity resolution in XHTML]]
( ([TIME[2013-02-28 19:03:05 +09:00]] 版))
<http://www.w3.org/TR/2013/WD-xhtml-pubid-20130228/>
[81] [[テキスト形式TRONコード]]
[82] [CITE@en[Public Identifiers for entity resolution in XHTML]]
( ([TIME[2013-08-22 23:43:40 +09:00]] 版))
<http://www.w3.org/TR/2013/WD-xhtml-pubid-20130822/>
[83] [CITE@en[Help:Formatting - MediaWiki]]
( ([TIME[2014-01-22 11:53:48 +09:00]] 版))
<http://www.mediawiki.org/wiki/Help:Formatting#Inserting_symbols>
[84] [CITE@en[XML Entity Definitions for Characters (2nd Edition)]]
( ([TIME[2014-02-10 23:03:18 +09:00]] 版))
<http://www.w3.org/TR/2014/PER-xml-entity-names-20140211/>
[86] [CITE[ncsa-mosaic/CHANGES at master · alandipert/ncsa-mosaic]]
( ([TIME[2014-04-07 05:42:16 +09:00]] 版))
<https://github.com/alandipert/ncsa-mosaic/blob/master/CHANGES#L1310>
[87] [CITE@en[XML Entity Definitions for Characters (2nd Edition)]]
( ([TIME[2014-04-10 02:49:23 +09:00]] 版))
<http://www.w3.org/TR/2014/REC-xml-entity-names-20140410/>
[88] [CITE@EN[XQuery 3.0: An XML Query Language]]
( ([TIME[2014-04-08 08:26:21 +09:00]] 版))
<http://www.w3.org/TR/xquery-30/#dt-character-reference>