/
879.txt
173 lines (135 loc) · 8.63 KB
/
879.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
[413] [DFN[[CODE(HTTP)@en[[[Accept-Charset:]]]]]] [[ヘッダー]]は、
[[テキスト]]の[[応答]]で[[利用者エージェント]]が受け入れられる [[charset]]
を指定するものです [SRC[>>411]]。
[422] 歴史的には [[Web]] では様々な[[文字コード]]が使われており、
特定の[[言語]]のコミュニティーにおいて複数の[[文字コード]]が併存していたことがありましたから、
[CODE(HTTP)@en[[[Accept-Charset:]]]] によって[[利用者エージェント]]が対応している[[文字コード]]を明記し、
[[鯖]]は[[内容折衝]]によって指定された[[文字コード]]の[[資源]]を返すことが、
たまに行われていました。
[423] しかし現在では [[Web]] の[[文字コード]]は [[UTF-8]] に収束しつつありますし、
そうでないとしてもすべての [[Webブラウザー]]が特定の[[文字コード]]の集合を実装し
[WEAK[([[Encoding Standard]] を参照。)]]、[[鯖]]はそれらのうちのいずれかにより出力するようになっていますから、
[[内容折衝]]によって両者が摺り合わせを行う必要はなくなっています。
[[Webブラウザー]]も00年代までは [CODE(HTTP)@en[[[Accept-Charset:]]]]
[[ヘッダー]]を[[要求]]に含めていましたが、現在では含めなくなっています。
* 仕様書
[REFS[
- [411] [CITE@en[RFC 7231 - Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content]] ([TIME[2014-06-07 01:55:45 +09:00]] 版) <https://tools.ietf.org/html/rfc7231#section-5.3.3>
]REFS]
* 意味
[420] [[要求]]に [CODE(HTTP)@en[[[Accept-Charset:]]]] がなければ、
任意の [[charset]] を受け入れることを表します [SRC[>>411]]。
* 文脈
[415] 複数個の[[ヘッダー]]を含めることができます。
* 構文
[414] [[欄値]]は、1つ以上の値の[[リスト]] ([CODE[#]]) です [SRC[>>411]]。
[FIG(railroad)[
= [[charset]] 名と[[引数]]
= *
== [[OWS]]
== [CODE(HTTP)[[[,]]]]
== [[OWS]]
== [[charset]] 名と[[引数]]
]FIG]
[416] それぞれの値は、 [[IANA]] [[charset]] 名か [CODE[[[*]]]] か、
それらのいずれかの後に [CODE(HTTP)@en[[[q]]]] [[引数]]を付加したものです [SRC[>>411]]。
[FIG(railroad)[
= |
== [[字句]]
== [CODE[[[*]]]]
= ?
== [CODE[[[OWS]]]]
== [CODE[[[;]]]]
== [CODE[[[OWS]]]]
== |
=== [CODE[[[q]]]]
=== [CODE[[[Q]]]]
== [CODE[[[=]]]]
== [[品質値]]
]FIG]
;; [417] [CODE(HTTP)@en[[[q]]]] 以外の[[引数]]は使えません。
[418] [CODE[[[*]]]] は、 [CODE(HTTP)@en[[[Accept-Charset:]]]] に明示されていないすべての
[[charset]] を表します [SRC[>>411]]。
* 処理モデル
[424] [[文字コード]]が [[UTF-8]] に収束しつつある現在、[[利用者エージェント]]は
[CODE(HTTP)@en[[[Accept-Charset:]]]] [[ヘッダー]]を[[生成]]するべきではありませんし、
[[起源鯖]]は [CODE(HTTP)@en[[[Accept-Charset:]]]] [[ヘッダー]]を無視して常に
[[UTF-8]] を使うべきです。
[419] [CODE[[[*]]]] がなければ、明示されていないすべての [[charset]]
は受け入れられないものとみなします [SRC[>>411]]。
[421] [[起源鯖]]は、 [CODE(HTTP)@en[[[Accept-Charset:]]]] に利用可能な[[表現]]の
[[charset]] がなければ、 [CODE(HTTP)@en[[[406]]]] を返すこともできますし、
無視して[[内容折衝]]の対象でないものとして処理することもできます [SRC[>>411]]。
* 歴史
[FIG(quote)[
[FIGCAPTION[
[408] RFC 1945 (HTTP/1.0) D.2.2; RFC 2068・2616 (HTTP/1.1) 14.2 Accept-Charset
]FIGCAPTION]
> The Accept-Charset request-header field can be used to indicate [DEL[[INS[{1945}]] a list of preferred character sets other than the default US-ASCII and ISO-8859-1]] [INS[[INS[{2068,2616}]] what character sets are acceptable for the response]]. This field allows
clients capable of understanding more comprehensive or
special-purpose character sets to signal that capability to a server which is
capable of representing documents in those character sets. [DEL[[INS[[INS[{2068}]] The ISO-8859-1 character set can be assumed to be acceptable to all user agents.]]]]
[CODE(HTTP)[Accept-Charset]] 要求頭欄は、
応答にどの文字集合が受入れ可能であるかを示すのに使うことが出来ます。
この欄によって、より包括的な、
あるいは特殊目的の文字集合を理解する能力があるクライアントが、
その能力をそれらの文字集合で文書を表現する能力があるサーバーに通知することができます。 [DEL[[CODE(charset)[[[ISO-8859-1]]]] 文字集合は全ての利用者エージェントに受入れ可能であると仮定できます。]]
[INS[
>
- [DEL[[INS[{2068}]] [CODE(ABNF)[[DFN[Accept-Charset]] = "Accept-Charset" ":" 1#( charset [ ";" "q" "=" qvalue ] )]]]]
- [INS[[INS[{2616}]] [CODE(ABNF)[[DFN[Accept-Charset]] = "Accept-Charset" ":" 1#( ( charset | "*" )[ ";" "q" "=" qvalue ] )]]]]
>Character set values are described in section 3.4. Each charset [DEL[[INS[{2068}]] may]] [INS[[INS[{2616}]] MAY]]
be given an associated quality value which represents the user's
preference for that charset. The default value is q=1. An example is
文字集合値は 3.4 節で説明しています。各 charset
は、その charset についての利用者の優先度を表す、関連付けられた品質値を与えても'''構いません'''。
既定値は [CODE(HTTP)[q=1]] です。例:
- Accept-Charset: iso-8859-5, unicode-1-1;q=0.8
[INS[
>[INS[{2616}]] The special value "*", if present in the Accept-Charset field,
matches every character set (including ISO-8859-1) which is not
mentioned elsewhere in the Accept-Charset field. If no "*" is present
in an Accept-Charset field, then all character sets not explicitly
mentioned get a quality value of 0, except for ISO-8859-1, which gets
a quality value of 1 if not explicitly mentioned.
特殊な値 [CODE(HTTP)[*]] が [CODE(HTTP)[Accept-Charset]]
欄に出現した場合、 [CODE(HTTP)[Accept-Charset]] 欄で他に触れられていない各文字集合
([CODE(charset)[ISO-8859-1]] を含む。) に一致します。
[CODE(HTTP)[*]] が [CODE(HTTP)[Accept-Charset]]
欄中に出現しない場合は、陽に触れられていないすべての文字集合が品質値
[CODE(HTTP)[0]] を得ます。但し [CODE(charset)[ISO-8859-1]]
は、陽に示されていない限り品質値 [CODE(HTTP)[1]]
を得ます。
]INS]
> If no Accept-Charset header is present, the default is that any
character set is acceptable. If an Accept-Charset header is present,
and if the server cannot send a response which is acceptable
according to the Accept-Charset header, then the server SHOULD send
an error response with the 406 (not acceptable) status code, though
the sending of an unacceptable response is also allowed.
[CODE(HTTP)[Accept-Charset]] 頭が示されている場合、
既定値は全ての文字集合が受入れ可能、です。
[CODE(HTTP)[Accept-Charset]] 頭が示されている場合、
そしてサーバーが [CODE(HTTP)[Accept-Charset]] 頭に従って受入れ可能な応答を送ることが出来ない場合は、
サーバーは [CODE(HTTP)[[[406]]]] (受入れ不能) 状態符号の誤り応答を送る'''べきです'''。
但し受入れ不能な応答を送ることも認められています。
]INS]
]FIG]
[407] [CITE@en[Accept-Charset Is No More]]
( ([[Henri Sivonen]] 著, [TIME[2012-02-07 15:56:01 +09:00]] 版))
<http://hsivonen.iki.fi/accept-charset/>
[409] [CITE@en[RFC 4463 - A Media Resource Control Protocol (MRCP) Developed by Cisco, Nuance, and Speechworks]]
( ([TIME[2011-12-04 10:31:11 +09:00]] 版))
<http://tools.ietf.org/html/rfc4463#section-5.4.3>
[410] [CITE@en[RFC 6787 - Media Resource Control Protocol Version 2 (MRCPv2)]]
( ([TIME[2012-11-13 15:18:40 +09:00]] 版))
<http://tools.ietf.org/html/rfc6787#section-6.2.5>
[412] 現在ではどの [[Webブラウザー]]も [CODE(HTTP)@en[[[Accept-Charset:]]]]
[[ヘッダー]]を送信しないようです。 [TIME[2014-07-04T12:38:44.400Z]]
* 関連
[425] [[HTML]] の [CODE(HTMLa)@en[[[accept-charset]]]] [[属性]]は [[HTTP]]
の [CODE(HTTP)@en[[[Accept-Charset:]]]] [[ヘッダー]]に影響を受けていますが、
現在は異なる構文と処理モデルを有していて、定義上両者に関係はありません。
[426] [CODE(HTTP)@en[[[Accept-Charset:]]]] は[[文字コード]]に関するもので、
[[言語]] ([CODE(HTTP)@en[[[Accept-Language:]]]]) や[[内容符号化]]
([CODE(HTTP)@en[[[Accept-Encoding:]]]]) とは無関係です。