出力符号化

符号化の取得

[4] 符号化の取得 (get an encoding) は、 符号化ラベルから符号化を取得する操作です。

仕様書

性質

[14] 符号化ラベルと期待される文字列を入力とし、文字符号化または失敗を返します。

[16] 符号化ラベルは、 Encoding Standard で規定されたもののいずれかでなければなりません。

[17] それ以外の任意の文字コード文字コード名称の利用は認められておらず、 失敗となります。

[21] 符号化ラベルは、ASCII大文字・小文字不区別です。

[15] 符号化ラベルの前後にASCII空白があっても構いません。

操作

[6] 文字列ラベルについて符号化を取得 (get an encoding) するには、 次のようにします >>5

  1. [7] ラベルの先頭と末尾のASCII空白をすべて除去します。
  2. [8] ラベル符号化ラベルのいずれかと ASCII大文字・小文字不区別で一致する場合、
    1. [9] その符号化ラベルの表す符号化を返します。
  3. [19] それ以外の場合、
    1. [20] 失敗を返します。

[18] 符号化ラベル符号化は、それぞれの項を参照。

後処理

[11] いくつかの処理では、 特定の符号化について、 ラベルが指定されても他の符号化と読み替えるとの特別な扱いが規定されています。

[25] 符号化の読み替え
specified
指定された符号化
meta
meta 要素での解釈 >>12, >>10
css
UTF-16 以外で書かれた @charsetencoding="" での解釈
output
出力符号化としての解釈 >>13
specified
UTF-16BE
meta
UTF-8
output
UTF-8
css
UTF-8
specified
UTF-16LE
meta
UTF-8
output
UTF-8
css
UTF-8
specified
x-user-defined
meta
windows-1252
output
そのまま
css
そのまま
specified
replacement
output
UTF-8
meta
そのまま
css
そのまま
specified
その他
meta
そのまま
output
そのまま
css
そのまま

文脈

[27] 符号化を取得する場面
[28] 出力符号化を使う場面

歴史

出力符号化

[22] Fix #29: introduce output encoding for URL and HTML forms · whatwg/encoding@02c55f2 ( 版) https://github.com/whatwg/encoding/commit/02c55f23fc1968f68472d3e82e5da29c4fe0ec65

[23] Use the "get an output encoding" from the Encoding Standard · whatwg/url@a9197f7 ( 版) https://github.com/whatwg/url/commit/a9197f7714e6b125f1f760ca1aa661530261773c

[24] Update integration with Encoding Standard · whatwg/html@6a31c26 ( 版) https://github.com/whatwg/html/commit/6a31c26cf12e39dab1a488e75dd56c03d6786d39

[26] Regression: do not use "get an output encoding" for decoding · whatwg/html@c36f738 ( 版) https://github.com/whatwg/html/commit/c36f7384f1f617b13c68d28b89d850cb18ceadfb

overrideMimeType

[1] Fix overrideMimeType() again (annevk著, ) https://github.com/whatwg/xhr/commit/121cee50b6f51215f046266642964b4c53a02a7c

[2] Look at overrideMimeType() again · Issue #157 · whatwg/xhr () https://github.com/whatwg/xhr/issues/157

[3] Fix overrideMimeType() again by annevk · Pull Request #174 · whatwg/xhr () https://github.com/whatwg/xhr/pull/174

[29] Give clearer advice on hooks for standards (annevk著, ) https://github.com/whatwg/encoding/commit/b579018b406d7752f8b7a3aa9c2bc800519c6f1a