-
Notifications
You must be signed in to change notification settings - Fork 4
/
695.txt
155 lines (113 loc) · 8.21 KB
/
695.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
[1] [DFN[ASCII [RUBYB[大文字・小文字不区別]@en[case‐insensitive]]]]とは、
[[ASCII]] に含まれる[[ラテン文字]]について、それらに限り[[大文字]]と[[小文字]]を区別しないことをいいます。
[9] [[照合順序]] [DFN[[CODE[i;ascii-casemap]]]] は、 [[ASCII]] の[[大文字]]を[[小文字]]に置き換えることにより[[比較]]や[[整列]]を行う[[照合順序]]です。
[4] [[Unicode]] には [[ASCII]] [[文字]]以外の[[ラテン文字]]や[[ラテン文字]]以外の[[アルファベット]]も含まれますが、
[[ASCII大文字・小文字不区別]]な比較では、[[ASCII]] の26組のみが同一視され、それ以外はすべて互いに異なる[[文字]]とみなされます。
[29] 歴史的に[[プログラミング言語]]や[[プロトコル]]や[[マーク付け言語]]などで [[ASCII文字]]が[[識別子]]や構文要素として使われてきましたが、
便宜上、[[大文字]]と[[小文字]]を区別しないことがよくあります。
これをそのまま[[Unicode文字]]の範囲に拡大すると、[[大文字]]と[[小文字]]の対応関係が相当複雑で[[多対多対応]]になったり[[ロケール]]依存になったりしてしまい、
実装サイズは増大し処理速度も低下します。しかし用途的にほとんどの場合は
[[ASCII文字]]の[[大文字]]と[[小文字]]の同一視さえできればよく、
[[非ASCII文字]]が[[ASCII文字]]と同一視されることも排除できた方が処理には好都合です。
[[ASCII大文字・小文字不区別]]なら、対象が [[Unicode文字]]であっても、
[[ASCII文字]]のみの[[大文字]]・[[小文字]]の同一視と同程度の複雑さ、実装サイズ、処理速度で済むのです。
* 仕様書
[REFS[
-[2] [[Web Applications 1.0]]
-- <http://www.whatwg.org/specs/web-apps/current-work/complete.html#ascii-case-insensitive>
- [16] [CITE@en-US[Cross-Origin Resource Sharing]] ([TIME[2012-03-01 14:32:22 +09:00]] 版) <http://dvcs.w3.org/hg/cors/raw-file/tip/Overview.html#ascii-case-insensitive>
- [8] [CITE@en[RFC 4790 - Internet Application Protocol Collation Registry]] ([TIME[2012-02-11 23:12:01 +09:00]] 版) <http://tools.ietf.org/html/rfc4790#section-9.2>
- [11] [CITE[ASCII Casemap]] ([TIME[2011-07-15 20:29:34 +09:00]] 版) <http://www.iana.org/assignments/collation/i%3Bascii-casemap.xml>
- [19] [CITE@en[XSLT and XQuery Serialization 3.0]] ([TIME[2014-04-07 23:19:15 +09:00]] 版) <http://www.w3.org/TR/xslt-xquery-serialization-3/#caseless-compare>
- [21] [CITE@en[RFC 6797 - HTTP Strict Transport Security (HSTS)]] ([TIME[2014-06-02 05:16:10 +09:00]] 版) <http://tools.ietf.org/html/rfc6797#section-4>
- [25] [CITE@en[RFC 6455 - The WebSocket Protocol]] ([TIME[2015-03-11 20:42:50 +09:00]] 版) <http://tools.ietf.org/html/rfc6455#section-2.1>
]REFS]
* 定義
[FIG[
[10]
>Comparing two strings in an [DFN[ASCII case-insensitive]] manner means comparing them exactly, code point for code point, except that the characters in the range [CODE(char)[[[U+0041]]]] to [CODE(char)[[[U+005A]]]] (i.e. [CODE(charname)@en[[[LATIN CAPITAL LETTER A]]]] to [CODE(charname)@en[[[LATIN CAPITAL LETTER Z]]]]) and the corresponding characters in the range [CODE(char)[[[U+0061]]]] to [CODE(char)[[[U+007A]]]] (i.e. [CODE(charname)@en[[[LATIN SMALL LETTER A]]]] to [CODE(charname)@en[[[LATIN SMALL LETTER Z]]]]) are considered to also match.
[FIGCAPTION[
[[Web Applications 1.0]] [SRC[>>2]] より、[[CORS]] [SRC[>>16]] や
[[HSTS]] [SRC[>>21]]、 [[WebSocket]] [SRC[>>25]] もほぼ同じ
]FIGCAPTION]
]FIG]
[20] [[XPath 3.0]]/[[XQuery 3.0]] における [DFN[[[without regard to case]]]] な[[比較]]とは、
[[ASCII]] の範囲の[[大文字]]を[[小文字]]に置き換えて[[比較]]することをいいます [SRC[>>19]]。
* 応用
[12] [[ASCII大文字・小文字不区別]]は、 [[HTML]] や [[CSS]]、[[DOM]] などで[[大文字]]と[[小文字]]を区別しないことの定義として広く用いられています。
[EG[
[13] 例えば [[HTML]] の[[要素]]の名前は [[ASCII大文字・小文字不区別]]です。
]EG]
[HISTORY[
[14] [[i;ascii-casemap]] は [[RFC 6454]] の[[起源]]の定義で使われていました。
;; [15] [[ASCII大文字・小文字不区別]]とするべきところ、 [[IETF]] で定義されたために同じく [[IETF]]
の [[i;ascii-casemap]] を参照しているのでしょう。
]HISTORY]
[18] [[RFC 6265]] では [[i;ascii-casemap]] によって一致することを[DFN[[RUBYB[大文字・小文字不区別で一致]@en[case-insensitively match]]]]と呼んでいます [SRC[>>17]]。
[REFS[
- [17] [CITE@en[RFC 6265 - HTTP State Management Mechanism]] ([TIME[2012-03-01 09:57:02 +09:00]] 版) <http://tools.ietf.org/html/rfc6265#page-6>
]REFS]
[23] [[mDNS]] も [[Unicode文字列]]に対して[[ASCII大文字・小文字不区別]]を規定しています
(ただしこの比較方法に呼称を与えていません)。
* 演算
[30] 次の[[写像]]は、[[ASCII大文字・小文字不区別]]と実質的に同義ですが、
[[比較]]演算ではなく[[正規化]]演算を行うものです。
[FIG(list)[
- [[ASCII小文字に変換]]
- [[ASCII大文字に変換]]
]FIG]
* 関連
[3] [[ASCII大文字・小文字不区別]]より大雑把な比較方法として、[[互換性大文字・小文字不区別]]があります。
[22] [[DNS]] ([[伝統的ドメイン名]]) における扱いは、 [[ASCIIラベル]]を参照してください。
([[byte case-insensitive]] に相当します。)
* メモ
[5] [[Unicode]] には [CODE(char)[[[U+0130]]]]、[CODE(char)[[[U+0131]]]]
の2つの[[文字]]が場合によっては [[ASCII]] の [CODE(char)[[[I]]]] や
[CODE(char)[[[i]]]] と同一視されますが、[[ASCII大文字・小文字不区別]]な比較では同一視''されません''。
[6] [[HTML]] では、[[大文字]]と[[小文字]]の区別の必要がないほとんどすべての場面で、
[[ASCII大文字・小文字不区別]]な比較が行われます。
[7] [CITE@en[RFC 1958 - Architectural Principles of the Internet]]
( ([TIME[2011-06-05 09:19:25 +09:00]] 版))
<http://tools.ietf.org/html/rfc1958#section-4>
>4.3 Public (i.e. widely visible) names should be in case-independent
ASCII. Specifically, this refers to DNS names, and to protocol
elements that are transmitted in text format.
[24] [CITE@en[Add a common conjugation of case-sensitive for use by CSS. Also indic… · whatwg/dom@c3d7ce0]]
([TIME[2015-05-11 11:22:19 +09:00]] 版)
<https://github.com/whatwg/dom/commit/c3d7ce0eb0af63c3e4fe665c399df6bd7e5162d9>
[FIG(quote)[
[FIGCAPTION[
[26] [CITE@en[RFC 4791 - Calendaring Extensions to WebDAV (CalDAV)]]
([TIME[2016-01-10 08:25:07 +09:00]] 版)
<https://tools.ietf.org/html/rfc4791#section-7.5>
]FIGCAPTION]
> CalDAV servers are REQUIRED to support the "i;ascii-casemap" and
> "i;octet" collations, as described in '''['''RFC4790''']''', and MAY support
> other collations.
]FIG]
[FIG(quote)[
[FIGCAPTION[
[27] [CITE@en[RFC 4791 - Calendaring Extensions to WebDAV (CalDAV)]]
([TIME[2016-01-10 08:25:07 +09:00]] 版)
<https://tools.ietf.org/html/rfc4791#section-7.5>
]FIGCAPTION]
> In the absence of a collation explicitly specified by the client, or
> if the client specifies the "default" collation identifier (as
> defined in '''['''RFC4790''']''', Section 3.1), the server MUST default to using
> "i;ascii-casemap" as the collation.
]FIG]
[FIG(quote)[
[FIGCAPTION[
[28] [CITE@en[RFC 5255 - Internet Message Access Protocol Internationalization]]
([TIME[2016-01-10 21:18:21 +09:00]] 版)
<https://tools.ietf.org/html/rfc5255#section-4.5>
]FIGCAPTION]
> Other legacy servers use the i;ascii-casemap
> comparator (see '''['''RFC4790''']''').
]FIG]
[31] [CITE@en[Editorial: start using the Infra Standard]]
([[annevk]]著, [TIME[2016-11-18 20:21:54 +09:00]])
<https://github.com/whatwg/encoding/commit/a26f76889bf393999e9caad84a3647ab09c39e09>
[32] [CITE@en[Editorial: leave ASCII case-insensitive to Infra]]
([[annevk]]著, [TIME[2016-11-18 20:39:03 +09:00]])
<https://github.com/whatwg/html/commit/5f3f27bfdf0e0139f6cf5f22508f37710d917c00>