[8] [DFN[[RUBYB[[[符号化ラベル]]]@en[encoding label]]]]は、
[[文字符号化]]を[[識別]]する短い[[文字列]]です。[[文字符号化]]ごとにいくつか定められています。

* 仕様書

[REFS[
- [6] [CITE@en-US[Encoding Standard]] ([TIME[2016-07-29 16:12:31 +09:00]]) <https://encoding.spec.whatwg.org/#label>
]REFS]

* 意味

[7] [[符号化][文字符号化]]は、1つ[[以上]]の[DFN[[RUBYB[ラベル]@en[label]]]]を持ちます [SRC[>>6]]。

* 演算

[16] [[符号化の取得]]により、[[符号化ラベル]]から[[文字符号化]]を得ることができます。

* 文脈

[2] 次の場面で使うことができます。

[FIG(list short)[ [17] [[符号化ラベル]]を使う場面
- [[[CODE[charset]]引数]]
- [CODE(HTML)@en[<meta charset>]]
- [CODE(HTML)@en[<meta http-equiv=Content-Type>]]
- [CODE(HTML)@en[[[<script charset>]]]]
]FIG]

* 関連

[4] [[符号化名]]は、 [DEL[[[replacement]] を除き、]] すべて[[符号化ラベル]]でもあります。

[3] [CODE(HTML)@en[[[<script charset>]]]] では、 [[Content-Typeメタデータ]]の
[F[[CODE(MIME)@en[[[charset]]]]]] の値と同じ[[文字符号化]]を表さなければならないとの制約があります。

;; [CODE(HTML)@en[[[<script charset>]]]] 参照。

** IANA charset との関係

[9] [[符号化ラベル]]は、 [[IANA charset]] から派生したものですが、
長い [[Web]] の歴史において色々な原因で増えたバリエーションを収録し、
[[Web]] で使われないものや[[セキュリティー]]上問題があるものを除去することで、
成立しました。

[10] 従って、[[IANA charset]] と似ていますが、包含関係はありません。
同じ[[識別子]]であっても、 [[符号化ラベル]]と解釈する場合と [[IANA charset]]
と解釈する場合とで、異なる[[文字コード]]を表すことも少なくありません。

* 歴史

[1] [CITE@en[Fix #32: use the encoding name exposed by DOM and HTML <form> · whatwg/encoding@18bf4fa]]
([TIME[2016-02-11 11:49:10 +09:00]] 版)
<https://github.com/whatwg/encoding/commit/18bf4fa6f005a899696800a8f6b0d20f3a4c1c0e>

[5] [CITE@en[Regression: do not use "get an output encoding" for decoding · whatwg/html@c36f738]]
([TIME[2016-04-26 20:52:13 +09:00]] 版)
<https://github.com/whatwg/html/commit/c36f7384f1f617b13c68d28b89d850cb18ceadfb>

[11] [CITE@en[Add "replacement" as label for the replacement encoding by annevk · Pull Request #117 · whatwg/encoding]]
([TIME[2017-08-19 20:57:16 +09:00]])
<https://github.com/whatwg/encoding/pull/117>

[12] [CITE@en[Add "replacement" as a label for the replacement encoding · Issue #70 · whatwg/encoding]]
([TIME[2017-08-19 21:03:28 +09:00]])
<https://github.com/whatwg/encoding/issues/70>

[13] [CITE@en['''['''acgiow''']''' (2) Make encoding name normalisation part of the spec. ASCII…]]
([[Hixie]]著, [TIME[2008-05-23 07:15:00 +09:00]])
<https://github.com/whatwg/html/commit/fc1bb8fe3afa6af5a2d8e3af0df9153c43a40eab>

[14] [CITE@en[Let the Encoding Standard deal with the canonical name]]
([[annevk]]著, [TIME[2016-02-10 23:23:57 +09:00]])
<https://github.com/whatwg/dom/commit/2bf4e6273af4da39113dc27fa23dbd447329ec31>

[15] [CITE@en[Fix #32: use the encoding name exposed by DOM and HTML <form>]]
([[annevk]]著, [TIME[2016-02-10 23:20:18 +09:00]])
<https://github.com/whatwg/encoding/commit/18bf4fa6f005a899696800a8f6b0d20f3a4c1c0e>