TextDecoderStream: encoding プロパティ
encoding は TextDecoderStream インターフェイスの読み取り専用プロパティで、このデコーダーが使用するエンコーディングアルゴリズムの名前が入った文字列を返します。
エンコーダーは コンストラクター の label 引数で設定し、既定値は utf-8 となります。
値
文字列で、エンコーディング形式の名前を表す小文字の ASCII 名が入ります。
取りうる値は TextDecoder.encoding に挙げられているもの(エンコーディング API のエンコーディングにあるラベル)と同じです。
例
TextDecoderStream から encoding の値を返します。
js
stream = new TextDecoderStream();
console.log(stream.encoding); // 既定値の "utf-8" を返す
仕様書
| Specification |
|---|
| Encoding Standard # dom-textdecoder-encoding |
ブラウザーの互換性
BCD tables only load in the browser