CINXE.COM

Encoding Standard

<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport"> <meta content="#3c790a" name="theme-color"> <meta content="light dark" name="color-scheme"> <title>Encoding Standard</title> <link crossorigin href="https://resources.whatwg.org/standard-shared-with-dev.css" rel="stylesheet"> <link crossorigin href="https://resources.whatwg.org/standard.css" rel="stylesheet"> <link crossorigin href="https://resources.whatwg.org/spec.css" rel="stylesheet"> <link crossorigin href="https://resources.whatwg.org/logo-encoding.svg" rel="icon"> <script crossorigin defer src="https://resources.whatwg.org/commit-snapshot-shortcut-key.js"></script> <meta content="Bikeshed version 6270e4735, updated Tue Aug 6 12:12:30 2024 -0700" name="generator"> <meta content="68f9e529f94e8fac332db57f23d98a6588d1dcaa" name="revision"> <link crossorigin href="visualization-colors.css" rel="stylesheet"> <style>/* Boilerplate: style-dfn-panel */ :root { --dfnpanel-bg: #ddd; --dfnpanel-text: var(--text); --dfnpanel-target-bg: #ffc; --dfnpanel-target-outline: orange; } @media (prefers-color-scheme: dark) { :root { --dfnpanel-bg: #222; --dfnpanel-text: var(--text); --dfnpanel-target-bg: #333; --dfnpanel-target-outline: silver; } } .dfn-panel { position: absolute; z-index: 35; width: 20em; width: 300px; height: auto; max-height: 500px; overflow: auto; padding: 0.5em 0.75em; font: small Helvetica Neue, sans-serif, Droid Sans Fallback; background: var(--dfnpanel-bg); color: var(--dfnpanel-text); border: outset 0.2em; white-space: normal; /* in case it's moved into a pre */ } .dfn-panel:not(.on) { display: none; } .dfn-panel * { margin: 0; padding: 0; text-indent: 0; } .dfn-panel > b { display: block; } .dfn-panel a { color: var(--dfnpanel-text); } .dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; } .dfn-panel a:focus { outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color; } .dfn-panel > b + b { margin-top: 0.25em; } .dfn-panel ul { padding: 0 0 0 1em; list-style: none; } .dfn-panel li a { max-width: calc(300px - 1.5em - 1em); overflow: hidden; text-overflow: ellipsis; } .dfn-panel.activated { display: inline-block; position: fixed; left: 8px; bottom: 2em; margin: 0 auto; max-width: calc(100vw - 1.5em - .4em - .5em); max-height: 30vh; transition: left 1s ease-out, bottom 1s ease-out; } .dfn-panel .link-item:hover { text-decoration: underline; } .dfn-panel .link-item .copy-icon { opacity: 0; } .dfn-panel .link-item:hover .copy-icon, .dfn-panel .link-item .copy-icon:focus { opacity: 1; } .dfn-panel .copy-icon { display: inline-block; margin-right: 0.5em; width: 0.85em; height: 1em; border-radius: 3px; background-color: #ccc; cursor: pointer; } .dfn-panel .copy-icon .icon { width: 100%; height: 100%; background-color: #fff; display: flex; justify-content: center; align-items: center; position: relative; } .dfn-panel .copy-icon .icon::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 1px solid black; background-color: #ccc; opacity: 0.25; transform: translate(3px, -3px); } .dfn-panel .copy-icon:active .icon::before { opacity: 1; } .dfn-paneled[role="button"] { cursor: help; } .highlighted { animation: target-fade 3s; } @keyframes target-fade { from { background-color: var(--dfnpanel-target-bg); outline: 5px solid var(--dfnpanel-target-outline); } to { color: var(--a-normal-text); background-color: transparent; outline: transparent; } } </style> <style>/* Boilerplate: style-mdn-anno */ :root { --mdn-bg: #EEE; --mdn-shadow: #999; --mdn-nosupport-text: #ccc; --mdn-pass: green; --mdn-fail: red; } @media (prefers-color-scheme: dark) { :root { --mdn-bg: #222; --mdn-shadow: #444; --mdn-nosupport-text: #666; --mdn-pass: #690; --mdn-fail: #d22; } } .mdn-anno { background: var(--mdn-bg, #EEE); border-radius: .25em; box-shadow: 0 0 3px var(--mdn-shadow, #999); color: var(--text, black); font: 1em sans-serif; hyphens: none; max-width: min-content; overflow: hidden; padding: 0.2em; position: absolute; right: 0.3em; top: auto; white-space: nowrap; word-wrap: normal; z-index: 8; } .mdn-anno.unpositioned { display: none; } .mdn-anno.overlapping-main { opacity: .2; transition: opacity .1s; } .mdn-anno[open] { opacity: 1; z-index: 9; min-width: 9em; } .mdn-anno:hover { opacity: 1; outline: var(--text, black) 1px solid; } .mdn-anno > summary { font-weight: normal; text-align: right; cursor: pointer; display: block; } .mdn-anno > summary > .less-than-two-engines-flag { color: var(--mdn-fail); padding-right: 2px; } .mdn-anno > summary > .all-engines-flag { color: var(--mdn-pass); padding-right: 2px; } .mdn-anno > summary > span { color: #fff; background-color: #000; font-weight: normal; font-family: zillaslab, Palatino, "Palatino Linotype", serif; padding: 2px 3px 0px 3px; line-height: 1.3em; vertical-align: top; } .mdn-anno > .feature { margin-top: 20px; } .mdn-anno > .feature:not(:first-of-type) { border-top: 1px solid #999; margin-top: 6px; padding-top: 2px; } .mdn-anno > .feature > .less-than-two-engines-text { color: var(--mdn-fail); } .mdn-anno > .feature > .all-engines-text { color: var(--mdn-pass); } .mdn-anno > .feature > p { font-size: .75em; margin-top: 6px; margin-bottom: 0; } .mdn-anno > .feature > p + p { margin-top: 3px; } .mdn-anno > .feature > .support { display: block; font-size: 0.6em; margin: 0; padding: 0; margin-top: 2px; } .mdn-anno > .feature > .support + div { padding-top: 0.5em; } .mdn-anno > .feature > .support > hr { display: block; border: none; border-top: 1px dotted #999; padding: 3px 0px 0px 0px; margin: 2px 3px 0px 3px; } .mdn-anno > .feature > .support > hr::before { content: ""; } .mdn-anno > .feature > .support > span { padding: 0.2em 0; display: block; display: table; } .mdn-anno > .feature > .support > span.no { color: var(--mdn-nosupport-text); filter: grayscale(100%); } .mdn-anno > .feature > .support > span.no::before { opacity: 0.5; } .mdn-anno > .feature > .support > span:first-of-type { padding-top: 0.5em; } .mdn-anno > .feature > .support > span > span { padding: 0 0.5em; display: table-cell; } .mdn-anno > .feature > .support > span > span:first-child { width: 100%; } .mdn-anno > .feature > .support > span > span:last-child { width: 100%; white-space: pre; padding: 0; } .mdn-anno > .feature > .support > span::before { content: ' '; display: table-cell; min-width: 1.5em; height: 1.5em; background: no-repeat center center; background-size: contain; text-align: right; font-size: 0.75em; font-weight: bold; } .mdn-anno > .feature > .support > .chrome_android::before { background-image: url(https://resources.whatwg.org/browser-logos/chrome.svg); } .mdn-anno > .feature > .support > .firefox_android::before { background-image: url(https://resources.whatwg.org/browser-logos/firefox.png); } .mdn-anno > .feature > .support > .chrome::before { background-image: url(https://resources.whatwg.org/browser-logos/chrome.svg); } .mdn-anno > .feature > .support > .edge_blink::before { background-image: url(https://resources.whatwg.org/browser-logos/edge.svg); } .mdn-anno > .feature > .support > .edge::before { background-image: url(https://resources.whatwg.org/browser-logos/edge_legacy.svg); } .mdn-anno > .feature > .support > .firefox::before { background-image: url(https://resources.whatwg.org/browser-logos/firefox.png); } .mdn-anno > .feature > .support > .ie::before { background-image: url(https://resources.whatwg.org/browser-logos/ie.png); } .mdn-anno > .feature > .support > .safari_ios::before { background-image: url(https://resources.whatwg.org/browser-logos/safari-ios.svg); } .mdn-anno > .feature > .support > .nodejs::before { background-image: url(https://nodejs.org/static/images/favicons/favicon.ico); } .mdn-anno > .feature > .support > .opera_android::before { background-image: url(https://resources.whatwg.org/browser-logos/opera.svg); } .mdn-anno > .feature > .support > .opera::before { background-image: url(https://resources.whatwg.org/browser-logos/opera.svg); } .mdn-anno > .feature > .support > .safari::before { background-image: url(https://resources.whatwg.org/browser-logos/safari.png); } .mdn-anno > .feature > .support > .samsunginternet_android::before { background-image: url(https://resources.whatwg.org/browser-logos/samsung.svg); } .mdn-anno > .feature > .support > .webview_android::before { background-image: url(https://resources.whatwg.org/browser-logos/android-webview.png); } .name-slug-mismatch { color: red; } .caniuse-status:hover { z-index: 9; } /* dt, li, .issue, .note, and .example are "position: relative", so to put annotation at right margin, must move to right of containing block */; .h-entry:not(.status-LS) dt > .mdn-anno, .h-entry:not(.status-LS) li > .mdn-anno, .h-entry:not(.status-LS) .issue > .mdn-anno, .h-entry:not(.status-LS) .note > .mdn-anno, .h-entry:not(.status-LS) .example > .mdn-anno { right: -6.7em; } .h-entry p + .mdn-anno { margin-top: 0; } h2 + .mdn-anno.after { margin: -48px 0 0 0; } h3 + .mdn-anno.after { margin: -46px 0 0 0; } h4 + .mdn-anno.after { margin: -42px 0 0 0; } h5 + .mdn-anno.after { margin: -40px 0 0 0; } h6 + .mdn-anno.after { margin: -40px 0 0 0; } </style> <style>/* Boilerplate: style-ref-hints */ :root { --ref-hint-bg: #ddd; --ref-hint-text: var(--text); } @media (prefers-color-scheme: dark) { :root { --ref-hint-bg: #222; --ref-hint-text: var(--text); } } .ref-hint { display: inline-block; position: absolute; z-index: 35; width: 20em; width: 300px; height: auto; max-height: 500px; overflow: auto; padding: 0.5em 0.5em; font: small Helvetica Neue, sans-serif, Droid Sans Fallback; background: var(--ref-hint-bg); color: var(--ref-hint-text); border: outset 0.2em; white-space: normal; /* in case it's moved into a pre */ } .ref-hint * { margin: 0; padding: 0; text-indent: 0; } .ref-hint ul { padding: 0 0 0 1em; list-style: none; } </style> <body class="h-entry status-LS"> <div class="head"> <a class="logo" href="https://whatwg.org/"> <img alt="WHATWG" class="darkmode-aware" crossorigin height="100" src="https://resources.whatwg.org/logo-encoding.svg"> </a> <hgroup> <h1 class="p-name no-ref" id="title">Encoding</h1> <p id="subtitle">Living Standard — Last Updated <time class="dt-updated" datetime="2024-10-04">4 October 2024</time> </p> </hgroup> <div data-fill-with="spec-metadata"> <dl> <dt>Participate: <dd><a href="https://github.com/whatwg/encoding">GitHub whatwg/encoding</a> (<a href="https://github.com/whatwg/encoding/issues/new/choose">new issue</a>, <a href="https://github.com/whatwg/encoding/issues">open issues</a>) <dd><a href="https://whatwg.org/chat">Chat on Matrix</a> <dt>Commits: <dd><a href="https://github.com/whatwg/encoding/commits">GitHub whatwg/encoding/commits</a> <dd><a href="/commit-snapshots/68f9e529f94e8fac332db57f23d98a6588d1dcaa/" id="commit-snapshot-link">Snapshot as of this commit</a> <dd><a href="https://twitter.com/encodings">@encodings</a> <dt>Tests: <dd><a href="https://github.com/web-platform-tests/wpt/tree/master/encoding">web-platform-tests encoding/</a> (<a href="https://github.com/web-platform-tests/wpt/labels/encoding">ongoing work</a>) <dt>Translations <small>(non-normative)</small>: <dd><span title="Japanese"><a href="https://triple-underscore.github.io/Encoding-ja.html" hreflang="ja" lang="ja" rel="alternate">日本語</a></span> </dl> </div> <div data-fill-with="warning"></div> </div> <div class="p-summary" data-fill-with="abstract"> <h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2> <p>The Encoding Standard defines encodings and their JavaScript API.</p> </div> <nav data-fill-with="table-of-contents" id="toc"> <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2> <ol class="toc" role="directory"> <li><a href="#preface"><span class="secno">1</span> <span class="content">Preface</span></a> <li><a href="#security-background"><span class="secno">2</span> <span class="content">Security background</span></a> <li><a href="#terminology"><span class="secno">3</span> <span class="content">Terminology</span></a> <li> <a href="#encodings"><span class="secno">4</span> <span class="content">Encodings</span></a> <ol class="toc"> <li><a href="#encoders-and-decoders"><span class="secno">4.1</span> <span class="content">Encoders and decoders</span></a> <li><a href="#names-and-labels"><span class="secno">4.2</span> <span class="content">Names and labels</span></a> <li><a href="#output-encodings"><span class="secno">4.3</span> <span class="content">Output encodings</span></a> </ol> <li><a href="#indexes"><span class="secno">5</span> <span class="content">Indexes</span></a> <li> <a href="#specification-hooks"><span class="secno">6</span> <span class="content">Hooks for standards</span></a> <ol class="toc"> <li><a href="#legacy-hooks"><span class="secno">6.1</span> <span class="content">Legacy hooks for standards</span></a> </ol> <li> <a href="#api"><span class="secno">7</span> <span class="content">API</span></a> <ol class="toc"> <li><a href="#interface-mixin-textdecodercommon"><span class="secno">7.1</span> <span class="content">Interface mixin <code class="idl"><span>TextDecoderCommon</span></code></span></a> <li><a href="#interface-textdecoder"><span class="secno">7.2</span> <span class="content">Interface <code class="idl"><span>TextDecoder</span></code></span></a> <li><a href="#interface-mixin-textencodercommon"><span class="secno">7.3</span> <span class="content">Interface mixin <code class="idl"><span>TextEncoderCommon</span></code></span></a> <li><a href="#interface-textencoder"><span class="secno">7.4</span> <span class="content">Interface <code class="idl"><span>TextEncoder</span></code></span></a> <li><a href="#interface-textdecoderstream"><span class="secno">7.5</span> <span class="content">Interface <code class="idl"><span>TextDecoderStream</span></code></span></a> <li><a href="#interface-textencoderstream"><span class="secno">7.6</span> <span class="content">Interface <code class="idl"><span>TextEncoderStream</span></code></span></a> </ol> <li> <a href="#the-encoding"><span class="secno">8</span> <span class="content">The encoding</span></a> <ol class="toc"> <li> <a href="#utf-8"><span class="secno">8.1</span> <span class="content">UTF-8</span></a> <ol class="toc"> <li><a href="#utf-8-decoder"><span class="secno">8.1.1</span> <span class="content">UTF-8 decoder</span></a> <li><a href="#utf-8-encoder"><span class="secno">8.1.2</span> <span class="content">UTF-8 encoder</span></a> </ol> </ol> <li> <a href="#legacy-single-byte-encodings"><span class="secno">9</span> <span class="content">Legacy single-byte encodings</span></a> <ol class="toc"> <li><a href="#single-byte-decoder"><span class="secno">9.1</span> <span class="content">single-byte decoder</span></a> <li><a href="#single-byte-encoder"><span class="secno">9.2</span> <span class="content">single-byte encoder</span></a> </ol> <li> <a href="#legacy-multi-byte-chinese-(simplified)-encodings"><span class="secno">10</span> <span class="content">Legacy multi-byte Chinese (simplified) encodings</span></a> <ol class="toc"> <li> <a href="#gbk"><span class="secno">10.1</span> <span class="content">GBK</span></a> <ol class="toc"> <li><a href="#gbk-decoder"><span class="secno">10.1.1</span> <span class="content">GBK decoder</span></a> <li><a href="#gbk-encoder"><span class="secno">10.1.2</span> <span class="content">GBK encoder</span></a> </ol> <li> <a href="#gb18030"><span class="secno">10.2</span> <span class="content">gb18030</span></a> <ol class="toc"> <li><a href="#gb18030-decoder"><span class="secno">10.2.1</span> <span class="content">gb18030 decoder</span></a> <li><a href="#gb18030-encoder"><span class="secno">10.2.2</span> <span class="content">gb18030 encoder</span></a> </ol> </ol> <li> <a href="#legacy-multi-byte-chinese-(traditional)-encodings"><span class="secno">11</span> <span class="content">Legacy multi-byte Chinese (traditional) encodings</span></a> <ol class="toc"> <li> <a href="#big5"><span class="secno">11.1</span> <span class="content">Big5</span></a> <ol class="toc"> <li><a href="#big5-decoder"><span class="secno">11.1.1</span> <span class="content">Big5 decoder</span></a> <li><a href="#big5-encoder"><span class="secno">11.1.2</span> <span class="content">Big5 encoder</span></a> </ol> </ol> <li> <a href="#legacy-multi-byte-japanese-encodings"><span class="secno">12</span> <span class="content">Legacy multi-byte Japanese encodings</span></a> <ol class="toc"> <li> <a href="#euc-jp"><span class="secno">12.1</span> <span class="content">EUC-JP</span></a> <ol class="toc"> <li><a href="#euc-jp-decoder"><span class="secno">12.1.1</span> <span class="content">EUC-JP decoder</span></a> <li><a href="#euc-jp-encoder"><span class="secno">12.1.2</span> <span class="content">EUC-JP encoder</span></a> </ol> <li> <a href="#iso-2022-jp"><span class="secno">12.2</span> <span class="content">ISO-2022-JP</span></a> <ol class="toc"> <li><a href="#iso-2022-jp-decoder"><span class="secno">12.2.1</span> <span class="content">ISO-2022-JP decoder</span></a> <li><a href="#iso-2022-jp-encoder"><span class="secno">12.2.2</span> <span class="content">ISO-2022-JP encoder</span></a> </ol> <li> <a href="#shift_jis"><span class="secno">12.3</span> <span class="content">Shift_JIS</span></a> <ol class="toc"> <li><a href="#shift_jis-decoder"><span class="secno">12.3.1</span> <span class="content">Shift_JIS decoder</span></a> <li><a href="#shift_jis-encoder"><span class="secno">12.3.2</span> <span class="content">Shift_JIS encoder</span></a> </ol> </ol> <li> <a href="#legacy-multi-byte-korean-encodings"><span class="secno">13</span> <span class="content">Legacy multi-byte Korean encodings</span></a> <ol class="toc"> <li> <a href="#euc-kr"><span class="secno">13.1</span> <span class="content">EUC-KR</span></a> <ol class="toc"> <li><a href="#euc-kr-decoder"><span class="secno">13.1.1</span> <span class="content">EUC-KR decoder</span></a> <li><a href="#euc-kr-encoder"><span class="secno">13.1.2</span> <span class="content">EUC-KR encoder</span></a> </ol> </ol> <li> <a href="#legacy-miscellaneous-encodings"><span class="secno">14</span> <span class="content">Legacy miscellaneous encodings</span></a> <ol class="toc"> <li> <a href="#replacement"><span class="secno">14.1</span> <span class="content">replacement</span></a> <ol class="toc"> <li><a href="#replacement-decoder"><span class="secno">14.1.1</span> <span class="content">replacement decoder</span></a> </ol> <li> <a href="#common-infrastructure-for-utf-16be-and-utf-16le"><span class="secno">14.2</span> <span class="content">Common infrastructure for <span>UTF-16BE/LE</span></span></a> <ol class="toc"> <li><a href="#shared-utf-16-decoder"><span class="secno">14.2.1</span> <span class="content">shared UTF-16 decoder</span></a> </ol> <li> <a href="#utf-16be"><span class="secno">14.3</span> <span class="content">UTF-16BE</span></a> <ol class="toc"> <li><a href="#utf-16be-decoder"><span class="secno">14.3.1</span> <span class="content">UTF-16BE decoder</span></a> </ol> <li> <a href="#utf-16le"><span class="secno">14.4</span> <span class="content">UTF-16LE</span></a> <ol class="toc"> <li><a href="#utf-16le-decoder"><span class="secno">14.4.1</span> <span class="content">UTF-16LE decoder</span></a> </ol> <li> <a href="#x-user-defined"><span class="secno">14.5</span> <span class="content">x-user-defined</span></a> <ol class="toc"> <li><a href="#x-user-defined-decoder"><span class="secno">14.5.1</span> <span class="content">x-user-defined decoder</span></a> <li><a href="#x-user-defined-encoder"><span class="secno">14.5.2</span> <span class="content">x-user-defined encoder</span></a> </ol> </ol> <li><a href="#browser-ui"><span class="secno">15</span> <span class="content">Browser UI</span></a> <li><a href="#implementation-considerations"><span class="secno"></span> <span class="content">Implementation considerations</span></a> <li><a href="#acknowledgments"><span class="secno"></span> <span class="content">Acknowledgments</span></a> <li><a href="#ipr"><span class="secno"></span> <span class="content">Intellectual property rights</span></a> <li> <a href="#section-index"><span class="secno"></span> <span class="content">Index</span></a> <ol class="toc"> <li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a> <li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a> </ol> <li> <a href="#references"><span class="secno"></span> <span class="content">References</span></a> <ol class="toc"> <li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a> <li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a> </ol> <li><a href="#idl-index"><span class="secno"></span> <span class="content">IDL Index</span></a> </ol> </nav> <main> <h2 class="heading settled" data-level="1" id="preface"><span class="secno">1. </span><span class="content">Preface</span><a class="self-link" href="#preface"></a></h2> <p>The UTF-8 encoding is the most appropriate encoding for interchange of Unicode, the universal coded character set. Therefore for new protocols and formats, as well as existing formats deployed in new contexts, this specification requires (and defines) the UTF-8 encoding. </p> <p>The other (legacy) encodings have been defined to some extent in the past. However, user agents have not always implemented them in the same way, have not always used the same labels, and often differ in dealing with undefined and former proprietary areas of encodings. This specification addresses those gaps so that new user agents do not have to reverse engineer encoding implementations and existing user agents can converge. </p> <p>In particular, this specification defines all those encodings, their algorithms to go from bytes to scalar values and back, and their canonical names and identifying labels. This specification also defines an API to expose part of the encoding algorithms to JavaScript. </p> <p>User agents have also significantly deviated from the labels listed in the <a href="https://www.iana.org/assignments/character-sets/character-sets.xhtml">IANA Character Sets registry</a>. To stop spreading legacy encodings further, this specification is exhaustive about the aforementioned details and therefore has no need for the registry. In particular, this specification does not provide a mechanism for extending any aspect of encodings. </p> <h2 class="heading settled" data-level="2" id="security-background"><span class="secno">2. </span><span class="content">Security background</span><a class="self-link" href="#security-background"></a></h2> <p>There is a set of encoding security issues when the producer and consumer do not agree on the encoding in use, or on the way a given encoding is to be implemented. For instance, an attack was reported in 2011 where a <a data-link-type="dfn" href="#shift_jis" id="ref-for-shift_jis">Shift_JIS</a> lead byte 0x82 was used to “mask” a 0x22 trail byte in a JSON resource of which an attacker could control some field. The producer did not see the problem even though this is an illegal byte combination. The consumer decoded it as a single U+FFFD and therefore changed the overall interpretation as U+0022 is an important delimiter. Decoders of encodings that use multiple bytes for scalar values now require that in case of an illegal byte combination, a scalar value in the range U+0000 to U+007F, inclusive, cannot be “masked”. For the aforementioned sequence the output would be U+FFFD U+0022. (As an unfortunate exception to this, the <a data-link-type="dfn" href="#gb18030-decoder" id="ref-for-gb18030-decoder">gb18030 decoder</a> will “mask” up to one such byte at <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream">end-of-queue</a>.) </p> <p>This is a larger issue for encodings that map anything that is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-byte" id="ref-for-ascii-byte">ASCII byte</a> to something that is not an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-code-point" id="ref-for-ascii-code-point">ASCII code point</a>, when there is no lead byte present. These are “ASCII-incompatible” encodings and other than <a data-link-type="dfn" href="#iso-2022-jp" id="ref-for-iso-2022-jp">ISO-2022-JP</a> and <a data-link-type="dfn" href="#utf-16be-le" id="ref-for-utf-16be-le">UTF-16BE/LE</a>, which are unfortunately required due to deployed content, they are not supported. (Investigation is <a href="https://github.com/whatwg/encoding/issues/8">ongoing</a> whether more labels of other such encodings can be mapped to the <a data-link-type="dfn" href="#replacement" id="ref-for-replacement">replacement</a> encoding, rather than the unknown encoding fallback.) An example attack is injecting carefully crafted content into a resource and then encouraging the user to override the encoding, resulting in, e.g., script execution. </p> <p>Encoders used by URLs found in HTML and HTML’s form feature can also result in slight information loss when an encoding is used that cannot represent all scalar values. E.g., when a resource uses the <a data-link-type="dfn" href="#windows-1252" id="ref-for-windows-1252">windows-1252</a> encoding a server will not be able to distinguish between an end user entering “💩” and “&amp;#128169;” into a form. </p> <p>The problems outlined here go away when exclusively using UTF-8, which is one of the many reasons that is now the mandatory encoding for all things. </p> <p class="note" role="note">See also the <a href="#browser-ui">Browser UI</a> chapter. </p> <h2 class="heading settled" data-level="3" id="terminology"><span class="secno">3. </span><span class="content">Terminology</span><a class="self-link" href="#terminology"></a></h2> <p>This specification depends on the Infra Standard. <a data-link-type="biblio" href="#biblio-infra" title="Infra Standard">[INFRA]</a> </p> <p>Hexadecimal numbers are prefixed with "0x". </p> <p>In equations, all numbers are integers, addition is represented by "+", subtraction by "−", multiplication by "×", integer division by "/" (returns the quotient), modulo by "%" (returns the remainder of an integer division), logical left shifts by "&lt;&lt;", logical right shifts by ">>", bitwise AND by "&amp;", and bitwise OR by "|". </p> <p>For logical right shifts operands must have at least twenty-one bits precision. </p> <hr> <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="concept-stream">I/O queue</dfn> is a type of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list">list</a> with <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item">items</a> of a particular type (i.e., <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte" id="ref-for-byte">bytes</a> or <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#scalar-value" id="ref-for-scalar-value">scalar values</a>). <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="end-of-stream">End-of-queue</dfn> is a special <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item①">item</a> that can be present in <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream">I/O queues</a> of any type and it signifies that there are no more <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item②">items</a> in the queue. </p> <div class="note" role="note"> <p>There are two ways to use an <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream①">I/O queue</a>: in immediate mode, to represent I/O data stored in memory, and in streaming mode, to represent data coming in from the network. Immediate queues have <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream①">end-of-queue</a> as their last item, whereas streaming queues need not have it, and so their <a data-link-type="dfn" href="#concept-stream-read" id="ref-for-concept-stream-read">read</a> operation might block. </p> <p>It is expected that streaming <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream②">I/O queues</a> will be created empty, and that new <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item③">items</a> will be <a data-link-type="dfn" href="#concept-stream-push" id="ref-for-concept-stream-push">pushed</a> to it as data comes in from the network. When the underlying network stream closes, an <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream②">end-of-queue</a> item is to be <a data-link-type="dfn" href="#concept-stream-push" id="ref-for-concept-stream-push①">pushed</a> into the queue. </p> <p>Since reading from a streaming <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream③">I/O queue</a> might block, streaming <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream④">I/O queues</a> are not to be used from an <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-loop" id="ref-for-event-loop">event loop</a>. They are to be used <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel" id="ref-for-in-parallel">in parallel</a> instead. </p> </div> <p>To <dfn class="dfn-paneled" data-dfn-for="I/O queue" data-dfn-type="dfn" data-export id="concept-stream-read">read</dfn> an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item④">item</a> from an <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream⑤">I/O queue</a> <var>ioQueue</var>, run these steps: </p> <ol> <li> <p>If <var>ioQueue</var> <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty">is empty</a>, then wait until its <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-size" id="ref-for-list-size">size</a> is at least 1. </p> <li> <p>If <var>ioQueue</var>[0] is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream③">end-of-queue</a>, then return <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream④">end-of-queue</a>. </p> <li> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-remove" id="ref-for-list-remove">Remove</a> <var>ioQueue</var>[0] and return it. </p> </ol> <p>To <a data-link-type="dfn" href="#concept-stream-read" id="ref-for-concept-stream-read①">read</a> a number <var>number</var> of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item⑤">items</a> from <var>ioQueue</var>, run these steps: </p> <ol> <li> <p>Let <var>readItems</var> be « ». </p> <li> <p>Perform the following step <var>number</var> times: </p> <ol> <li> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append">Append</a> to <var>readItems</var> the result of <a data-link-type="dfn" href="#concept-stream-read" id="ref-for-concept-stream-read②">reading</a> an item from <var>ioQueue</var>. </p> </ol> <li> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-remove" id="ref-for-list-remove①">Remove</a> <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑤">end-of-queue</a> from <var>readItems</var>. </p> <li> <p>Return <var>readItems</var>. </p> </ol> <p>To <dfn class="dfn-paneled" data-dfn-for="I/O queue" data-dfn-type="dfn" data-export id="i-o-queue-peek">peek</dfn> a number <var>number</var> of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item⑥">items</a> from an <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream⑥">I/O queue</a> <var>ioQueue</var>, run these steps: </p> <ol> <li> <p>Wait until either <var>ioQueue</var>’s <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-size" id="ref-for-list-size①">size</a> is equal to or greater than <var>number</var>, or <var>ioQueue</var> <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-contain" id="ref-for-list-contain">contains</a> <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑥">end-of-queue</a>, whichever comes first. </p> <li> <p>Let <var>prefix</var> be « ». </p> <li> <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate">For each</a> <var>n</var> in <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#the-range" id="ref-for-the-range">the range</a> 1 to <var>number</var>, inclusive: </p> <ol> <li> <p>If <var>ioQueue</var>[<var>n</var>] is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑦">end-of-queue</a>, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#iteration-break" id="ref-for-iteration-break">break</a>. </p> <li> <p>Otherwise, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append①">append</a> <var>ioQueue</var>[<var>n</var>] to <var>prefix</var>. </p> </ol> <li> <p>Return <var>prefix</var>. </p> </ol> <p>To <dfn class="dfn-paneled" data-dfn-for="I/O queue" data-dfn-type="dfn" data-export id="concept-stream-push">push</dfn> an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item⑦">item</a> <var>item</var> to an <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream⑦">I/O queue</a> <var>ioQueue</var>, run these steps: </p> <ol> <li> <p>If the last <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item⑧">item</a> in <var>ioQueue</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑧">end-of-queue</a>, then: </p> <ol> <li> <p>If <var>item</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑨">end-of-queue</a>, do nothing. </p> <li> <p>Otherwise, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-insert" id="ref-for-list-insert">insert</a> <var>item</var> before the last <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item⑨">item</a> in <var>ioQueue</var>. </p> </ol> <li> <p>Otherwise, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append②">append</a> <var>item</var> to <var>ioQueue</var>. </p> </ol> <p>To <a data-link-type="dfn" href="#concept-stream-push" id="ref-for-concept-stream-push②">push</a> a sequence of items to an <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream⑧">I/O queue</a> <var>ioQueue</var> is to push each item in the sequence to <var>ioQueue</var>, in the given order. </p> <p>To <dfn class="dfn-paneled" data-dfn-for="I/O queue" data-dfn-type="dfn" data-noexport id="concept-stream-prepend">restore</dfn> an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item①⓪">item</a> other than <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream①⓪">end-of-queue</a> to an <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream⑨">I/O queue</a>, perform the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list①">list</a> <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-prepend" id="ref-for-list-prepend">prepend</a> operation. To <a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend">restore</a> a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list②">list</a> of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item①①">items</a> excluding <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream①①">end-of-queue</a> to an <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream①⓪">I/O queue</a>, insert those items, in the given order, before the first item in the queue. </p> <p class="example" id="example-tokens"><a class="self-link" href="#example-tokens"></a>Inserting the bytes « 0xF0, 0x9F » in an I/O queue « 0x92 0xA9, <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream①②">end-of-queue</a> », results in an I/O queue « 0xF0, 0x9F, 0x92 0xA9, <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream①③">end-of-queue</a> ». The next item to be read would be 0xF0. </p> <p>To <dfn class="dfn-paneled" data-dfn-for="from I/O queue" data-dfn-type="dfn" data-noexport id="from-i-o-queue-convert">convert</dfn> an <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream①①">I/O queue</a> <var>ioQueue</var> into a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list③">list</a>, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#string" id="ref-for-string">string</a>, or <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence" id="ref-for-byte-sequence">byte sequence</a>, return the result of <a data-link-type="dfn" href="#concept-stream-read" id="ref-for-concept-stream-read③">reading</a> an indefinite number of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item①②">items</a> from <var>ioQueue</var>. </p> <p>To <dfn class="dfn-paneled" data-dfn-for="to I/O queue" data-dfn-type="dfn" data-noexport id="to-i-o-queue-convert">convert</dfn> a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list④">list</a>, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#string" id="ref-for-string①">string</a>, or <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence" id="ref-for-byte-sequence①">byte sequence</a> <var>input</var> into an <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream①②">I/O queue</a>, run these steps: </p> <ol> <li> <p>Assert: if <var>input</var> is a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list⑤">list</a>, then it does not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-contain" id="ref-for-list-contain①">contain</a> <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream①④">end-of-queue</a>. </p> <li> <p>Return an <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream①③">I/O queue</a> containing the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item①③">items</a> in <var>input</var>, in order, followed by <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream①⑤">end-of-queue</a>. </p> </ol> <p class="XXX">The Infra standard is expected to define some infrastructure around type conversions. See <a href="https://github.com/whatwg/infra/issues/319">whatwg/infra issue #319</a>. <a data-link-type="biblio" href="#biblio-infra" title="Infra Standard">[INFRA]</a> </p> <p class="note" role="note"><a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream①④">I/O queues</a> are defined as <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list⑥">lists</a>, not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#queue" id="ref-for-queue">queues</a>, because they feature a <a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend①">restore</a> operation. However, this restore operation is an internal detail of the algorithms in this specification, and is not to be used by other standards. Implementations are free to find alternative ways to implement such algorithms, as detailed in <a href="#implementation-considerations">Implementation considerations</a>. </p> <hr> <p>To obtain a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="scalar-value-from-surrogates">scalar value from surrogates</dfn>, given a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#leading-surrogate" id="ref-for-leading-surrogate">leading surrogate</a> <var>leading</var> and a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#trailing-surrogate" id="ref-for-trailing-surrogate">trailing surrogate</a> <var>trailing</var>, return 0x10000 + ((<var>leading</var> − 0xD800) &lt;&lt; 10) + (<var>trailing</var> − 0xDC00). </p> <h2 class="heading settled" data-level="4" id="encodings"><span class="secno">4. </span><span class="content">Encodings</span><a class="self-link" href="#encodings"></a></h2> <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="encoding">encoding</dfn> defines a mapping from a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#scalar-value" id="ref-for-scalar-value①">scalar value</a> sequence to a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte" id="ref-for-byte①">byte</a> sequence (and vice versa). Each <a data-link-type="dfn" href="#encoding" id="ref-for-encoding">encoding</a> has a <dfn class="dfn-paneled" data-dfn-for="encoding" data-dfn-type="dfn" data-export id="name">name</dfn>, and one or more <dfn class="dfn-paneled" data-dfn-for="encoding" data-dfn-type="dfn" data-export data-lt="label" id="label">labels</dfn>. </p> <p class="note no-backref" role="note">This specification defines three <a data-link-type="dfn" href="#encoding" id="ref-for-encoding①">encodings</a> with the same names as <i>encoding schemes</i> defined in the Unicode standard: <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8">UTF-8</a>, <a data-link-type="dfn" href="#utf-16le" id="ref-for-utf-16le">UTF-16LE</a>, and <a data-link-type="dfn" href="#utf-16be" id="ref-for-utf-16be">UTF-16BE</a>. The <a data-link-type="dfn" href="#encoding" id="ref-for-encoding②">encodings</a> differ from the <i>encoding schemes</i> by byte order mark (also known as BOM) handling not being part of the <a data-link-type="dfn" href="#encoding" id="ref-for-encoding③">encodings</a> themselves and instead being part of wrapper algorithms in this specification, whereas byte order mark handling is part of the definition of the <i>encoding schemes</i> in the Unicode Standard. <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8①">UTF-8</a> used together with the <a data-link-type="dfn" href="#utf-8-decode" id="ref-for-utf-8-decode">UTF-8 decode</a> algorithm matches the <i>encoding scheme</i> of the same name. This specification does not provide wrapper algorithms that would combine with <a data-link-type="dfn" href="#utf-16le" id="ref-for-utf-16le①">UTF-16LE</a> and <a data-link-type="dfn" href="#utf-16be" id="ref-for-utf-16be①">UTF-16BE</a> to match the similarly-named <i>encoding schemes</i>. <a data-link-type="biblio" href="#biblio-unicode" title="The Unicode Standard">[UNICODE]</a> </p> <h3 class="heading settled" data-level="4.1" id="encoders-and-decoders"><span class="secno">4.1. </span><span class="content">Encoders and decoders</span><a class="self-link" href="#encoders-and-decoders"></a></h3> <p>Each <a data-link-type="dfn" href="#encoding" id="ref-for-encoding④">encoding</a> has an associated <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="decoder">decoder</dfn> and most of them have an associated <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="encoder">encoder</dfn>. Instances of <a data-link-type="dfn" href="#decoder" id="ref-for-decoder">decoders</a> and <a data-link-type="dfn" href="#encoder" id="ref-for-encoder">encoders</a> have a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="handler">handler</dfn> algorithm and might also have state. A <a data-link-type="dfn" href="#handler" id="ref-for-handler">handler</a> algorithm takes an input <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream①⑤">I/O queue</a> and an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item①④">item</a>, and returns <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="finished">finished</dfn>, one or more <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item①⑤">items</a>, <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="error">error</dfn> optionally with a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point">code point</a>, or <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="continue">continue</dfn>. </p> <p class="note no-backref" role="note">The <a data-link-type="dfn" href="#replacement" id="ref-for-replacement①">replacement</a> and <a data-link-type="dfn" href="#utf-16be-le" id="ref-for-utf-16be-le①">UTF-16BE/LE</a> <a data-link-type="dfn" href="#encoding" id="ref-for-encoding⑤">encodings</a> have no <a data-link-type="dfn" href="#encoder" id="ref-for-encoder①">encoder</a>. </p> <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="error-mode">error mode</dfn> as used below is "<code>replacement</code>" or "<code>fatal</code>" for a <a data-link-type="dfn" href="#decoder" id="ref-for-decoder①">decoder</a> and "<code>fatal</code>" or "<code>html</code>" for an <a data-link-type="dfn" href="#encoder" id="ref-for-encoder②">encoder</a>. </p> <p class="note" role="note">An XML processor would set <a data-link-type="dfn" href="#error-mode" id="ref-for-error-mode">error mode</a> to "<code>fatal</code>". <a data-link-type="biblio" href="#biblio-xml" title="Extensible Markup Language (XML) 1.0 (Fifth Edition)">[XML]</a> </p> <p class="note" role="note">"<code>html</code>" exists as <a data-link-type="dfn" href="#error-mode" id="ref-for-error-mode①">error mode</a> due to HTML forms requiring a non-terminating legacy <a data-link-type="dfn" href="#encoder" id="ref-for-encoder③">encoder</a>. The "<code>html</code>" <a data-link-type="dfn" href="#error-mode" id="ref-for-error-mode②">error mode</a> causes a sequence to be emitted that cannot be distinguished from legitimate input and can therefore lead to silent data loss. Developers are strongly encouraged to use the <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8②">UTF-8</a> <a data-link-type="dfn" href="#encoding" id="ref-for-encoding⑥">encoding</a> to prevent this from happening. <a data-link-type="biblio" href="#biblio-html" title="HTML Standard">[HTML]</a> </p> <hr> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="process a queue|processing a queue" data-noexport id="concept-encoding-run">process a queue</dfn> given an <a data-link-type="dfn" href="#encoding" id="ref-for-encoding⑦">encoding</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder②">decoder</a> or <a data-link-type="dfn" href="#encoder" id="ref-for-encoder④">encoder</a> instance <var>encoderDecoder</var>, <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream①⑥">I/O queue</a> <var>input</var>, <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream①⑦">I/O queue</a> <var>output</var>, and <a data-link-type="dfn" href="#error-mode" id="ref-for-error-mode③">error mode</a> <var>mode</var>: </p> <ol> <li> <p>While true: </p> <ol> <li> <p>Let <var>result</var> be the result of <a data-link-type="dfn" href="#concept-encoding-process" id="ref-for-concept-encoding-process">processing an item</a> with the result of <a data-link-type="dfn" href="#concept-stream-read" id="ref-for-concept-stream-read④">reading</a> from <var>input</var>, <var>encoderDecoder</var>, <var>input</var>, <var>output</var>, and <var>mode</var>. </p> <li> <p>If <var>result</var> is not <a data-link-type="dfn" href="#continue" id="ref-for-continue">continue</a>, then return <var>result</var>. </p> </ol> </ol> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="process an item|processing an item" data-noexport id="concept-encoding-process">process an item</dfn> given an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item①⑥">item</a> <var>item</var>, <a data-link-type="dfn" href="#encoding" id="ref-for-encoding⑧">encoding</a>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder⑤">encoder</a> or <a data-link-type="dfn" href="#decoder" id="ref-for-decoder③">decoder</a> instance <var>encoderDecoder</var>, <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream①⑧">I/O queue</a> <var>input</var>, <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream①⑨">I/O queue</a> <var>output</var>, and <a data-link-type="dfn" href="#error-mode" id="ref-for-error-mode④">error mode</a> <var>mode</var>: </p> <ol> <li> <p>Assert: if <var>encoderDecoder</var> is an <a data-link-type="dfn" href="#encoder" id="ref-for-encoder⑥">encoder</a> instance, <var>mode</var> is not "<code>replacement</code>". </p> <li> <p>Assert: if <var>encoderDecoder</var> is a <a data-link-type="dfn" href="#decoder" id="ref-for-decoder④">decoder</a> instance, <var>mode</var> is not "<code>html</code>". </p> <li> <p>Assert: if <var>encoderDecoder</var> is an <a data-link-type="dfn" href="#encoder" id="ref-for-encoder⑦">encoder</a> instance, <var>item</var> is not a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#surrogate" id="ref-for-surrogate">surrogate</a>. </p> <li> <p>Let <var>result</var> be the result of running <var>encoderDecoder</var>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler①">handler</a> on <var>input</var> and <var>item</var>. </p> <li> <p>If <var>result</var> is <a data-link-type="dfn" href="#finished" id="ref-for-finished">finished</a>: </p> <ol> <li> <p><a data-link-type="dfn" href="#concept-stream-push" id="ref-for-concept-stream-push③">Push</a> <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream①⑥">end-of-queue</a> to <var>output</var>. </p> <li> <p>Return <var>result</var>. </p> </ol> <li> <p>Otherwise, if <var>result</var> is one or more <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item①⑦">items</a>: </p> <ol> <li> <p>Assert: if <var>encoderDecoder</var> is a <a data-link-type="dfn" href="#decoder" id="ref-for-decoder⑤">decoder</a> instance, <var>result</var> does not contain any <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#surrogate" id="ref-for-surrogate①">surrogates</a>. </p> <li> <p><a data-link-type="dfn" href="#concept-stream-push" id="ref-for-concept-stream-push④">Push</a> <var>result</var> to <var>output</var>. </p> </ol> <li> <p>Otherwise, if <var>result</var> is an <a data-link-type="dfn" href="#error" id="ref-for-error">error</a>, switch on <var>mode</var> and run the associated steps: </p> <dl class="switch"> <dt>"<code>replacement</code>" <dd><a data-link-type="dfn" href="#concept-stream-push" id="ref-for-concept-stream-push⑤">Push</a> U+FFFD (�) to <var>output</var>. <dt>"<code>html</code>" <dd><a data-link-type="dfn" href="#concept-stream-push" id="ref-for-concept-stream-push⑥">Push</a> 0x26 (&amp;), 0x23 (#), followed by the shortest sequence of 0x30 (0) to 0x39 (9), inclusive, representing <var>result</var>’s <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point①">code point</a>’s <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point-value" id="ref-for-code-point-value">value</a> in base ten, followed by 0x3B (;) to <var>output</var>. <dt>"<code>fatal</code>" <dd>Return <var>result</var>. </dl> <li> <p>Return <a data-link-type="dfn" href="#continue" id="ref-for-continue①">continue</a>. </p> </ol> <h3 class="heading settled" data-level="4.2" id="names-and-labels"><span class="secno">4.2. </span><span class="content">Names and labels</span><a class="self-link" href="#names-and-labels"></a></h3> <p>The table below lists all <a data-link-type="dfn" href="#encoding" id="ref-for-encoding⑨">encodings</a> and their <a data-link-type="dfn" href="#label" id="ref-for-label">labels</a> user agents must support. User agents must not support any other <a data-link-type="dfn" href="#encoding" id="ref-for-encoding①⓪">encodings</a> or <a data-link-type="dfn" href="#label" id="ref-for-label①">labels</a>. </p> <p class="note" role="note">For each encoding, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-lowercase" id="ref-for-ascii-lowercase">ASCII-lowercasing</a> its <a data-link-type="dfn" href="#name" id="ref-for-name">name</a> yields one of its <a data-link-type="dfn" href="#label" id="ref-for-label②">labels</a>. </p> <p>Authors must use the <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8③">UTF-8</a> <a data-link-type="dfn" href="#encoding" id="ref-for-encoding①①">encoding</a> and must use its (<a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive">ASCII case-insensitive</a>) "<code>utf-8</code>" <a data-link-type="dfn" href="#label" id="ref-for-label③">label</a> to identify it. </p> <p>New protocols and formats, as well as existing formats deployed in new contexts, must use the <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8④">UTF-8</a> <a data-link-type="dfn" href="#encoding" id="ref-for-encoding①②">encoding</a> exclusively. If these protocols and formats need to expose the <a data-link-type="dfn" href="#encoding" id="ref-for-encoding①③">encoding</a>’s <a data-link-type="dfn" href="#name" id="ref-for-name①">name</a> or <a data-link-type="dfn" href="#label" id="ref-for-label④">label</a>, they must expose it as "<code>utf-8</code>". </p> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="get an encoding|getting an encoding" id="concept-encoding-get">get an encoding</dfn> from a string <var>label</var>, run these steps: </p> <ol> <li> <p>Remove any leading and trailing <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-whitespace" id="ref-for-ascii-whitespace">ASCII whitespace</a> from <var>label</var>. </p> <li> <p>If <var>label</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive①">ASCII case-insensitive</a> match for any of the labels listed in the table below, then return the corresponding <a data-link-type="dfn" href="#encoding" id="ref-for-encoding①④">encoding</a>; otherwise return failure. </p> </ol> <p class="note" role="note">This is a more basic and restrictive algorithm of mapping labels to <a data-link-type="dfn" href="#encoding" id="ref-for-encoding①⑤">encodings</a> than <a href="https://www.unicode.org/reports/tr22/tr22-8.html#Charset_Alias_Matching">section 1.4 of Unicode Technical Standard #22</a> prescribes, as that is necessary to be compatible with deployed content. </p> <table> <thead> <tr> <th>Name <th>Labels <tbody> <tr> <th colspan="2"><a href="#the-encoding">The Encoding</a> <tr> <td rowspan="6"><a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8⑤">UTF-8</a> <td>"<code>unicode-1-1-utf-8</code>" <tr> <td>"<code>unicode11utf8</code>" <tr> <td>"<code>unicode20utf8</code>" <tr> <td>"<code>utf-8</code>" <tr> <td>"<code>utf8</code>" <tr> <td>"<code>x-unicode20utf8</code>" <tbody> <tr> <th colspan="2"><a href="#legacy-single-byte-encodings">Legacy single-byte encodings</a> <tr> <td rowspan="4"><a data-link-type="dfn" href="#ibm866" id="ref-for-ibm866">IBM866</a> <td>"<code>866</code>" <tr> <td>"<code>cp866</code>" <tr> <td>"<code>csibm866</code>" <tr> <td>"<code>ibm866</code>" <tr> <td rowspan="9"><a data-link-type="dfn" href="#iso-8859-2" id="ref-for-iso-8859-2">ISO-8859-2</a> <td>"<code>csisolatin2</code>" <tr> <td>"<code>iso-8859-2</code>" <tr> <td>"<code>iso-ir-101</code>" <tr> <td>"<code>iso8859-2</code>" <tr> <td>"<code>iso88592</code>" <tr> <td>"<code>iso_8859-2</code>" <tr> <td>"<code>iso_8859-2:1987</code>" <tr> <td>"<code>l2</code>" <tr> <td>"<code>latin2</code>" <tr> <td rowspan="9"><a data-link-type="dfn" href="#iso-8859-3" id="ref-for-iso-8859-3">ISO-8859-3</a> <td>"<code>csisolatin3</code>" <tr> <td>"<code>iso-8859-3</code>" <tr> <td>"<code>iso-ir-109</code>" <tr> <td>"<code>iso8859-3</code>" <tr> <td>"<code>iso88593</code>" <tr> <td>"<code>iso_8859-3</code>" <tr> <td>"<code>iso_8859-3:1988</code>" <tr> <td>"<code>l3</code>" <tr> <td>"<code>latin3</code>" <tr> <td rowspan="9"><a data-link-type="dfn" href="#iso-8859-4" id="ref-for-iso-8859-4">ISO-8859-4</a> <td>"<code>csisolatin4</code>" <tr> <td>"<code>iso-8859-4</code>" <tr> <td>"<code>iso-ir-110</code>" <tr> <td>"<code>iso8859-4</code>" <tr> <td>"<code>iso88594</code>" <tr> <td>"<code>iso_8859-4</code>" <tr> <td>"<code>iso_8859-4:1988</code>" <tr> <td>"<code>l4</code>" <tr> <td>"<code>latin4</code>" <tr> <td rowspan="8"><a data-link-type="dfn" href="#iso-8859-5" id="ref-for-iso-8859-5">ISO-8859-5</a> <td>"<code>csisolatincyrillic</code>" <tr> <td>"<code>cyrillic</code>" <tr> <td>"<code>iso-8859-5</code>" <tr> <td>"<code>iso-ir-144</code>" <tr> <td>"<code>iso8859-5</code>" <tr> <td>"<code>iso88595</code>" <tr> <td>"<code>iso_8859-5</code>" <tr> <td>"<code>iso_8859-5:1988</code>" <tr> <td rowspan="14"><a data-link-type="dfn" href="#iso-8859-6" id="ref-for-iso-8859-6">ISO-8859-6</a> <td>"<code>arabic</code>" <tr> <td>"<code>asmo-708</code>" <tr> <td>"<code>csiso88596e</code>" <tr> <td>"<code>csiso88596i</code>" <tr> <td>"<code>csisolatinarabic</code>" <tr> <td>"<code>ecma-114</code>" <tr> <td>"<code>iso-8859-6</code>" <tr> <td>"<code>iso-8859-6-e</code>" <tr> <td>"<code>iso-8859-6-i</code>" <tr> <td>"<code>iso-ir-127</code>" <tr> <td>"<code>iso8859-6</code>" <tr> <td>"<code>iso88596</code>" <tr> <td>"<code>iso_8859-6</code>" <tr> <td>"<code>iso_8859-6:1987</code>" <tr> <td rowspan="12"><a data-link-type="dfn" href="#iso-8859-7" id="ref-for-iso-8859-7">ISO-8859-7</a> <td>"<code>csisolatingreek</code>" <tr> <td>"<code>ecma-118</code>" <tr> <td>"<code>elot_928</code>" <tr> <td>"<code>greek</code>" <tr> <td>"<code>greek8</code>" <tr> <td>"<code>iso-8859-7</code>" <tr> <td>"<code>iso-ir-126</code>" <tr> <td>"<code>iso8859-7</code>" <tr> <td>"<code>iso88597</code>" <tr> <td>"<code>iso_8859-7</code>" <tr> <td>"<code>iso_8859-7:1987</code>" <tr> <td>"<code>sun_eu_greek</code>" <tr> <td rowspan="11"><a data-link-type="dfn" href="#iso-8859-8" id="ref-for-iso-8859-8">ISO-8859-8</a> <td>"<code>csiso88598e</code>" <tr> <td>"<code>csisolatinhebrew</code>" <tr> <td>"<code>hebrew</code>" <tr> <td>"<code>iso-8859-8</code>" <tr> <td>"<code>iso-8859-8-e</code>" <tr> <td>"<code>iso-ir-138</code>" <tr> <td>"<code>iso8859-8</code>" <tr> <td>"<code>iso88598</code>" <tr> <td>"<code>iso_8859-8</code>" <tr> <td>"<code>iso_8859-8:1988</code>" <tr> <td>"<code>visual</code>" <tr> <td rowspan="3"><a data-link-type="dfn" href="#iso-8859-8-i" id="ref-for-iso-8859-8-i">ISO-8859-8-I</a> <td>"<code>csiso88598i</code>" <tr> <td>"<code>iso-8859-8-i</code>" <tr> <td>"<code>logical</code>" <tr> <td rowspan="7"><a data-link-type="dfn" href="#iso-8859-10" id="ref-for-iso-8859-10">ISO-8859-10</a> <td>"<code>csisolatin6</code>" <tr> <td>"<code>iso-8859-10</code>" <tr> <td>"<code>iso-ir-157</code>" <tr> <td>"<code>iso8859-10</code>" <tr> <td>"<code>iso885910</code>" <tr> <td>"<code>l6</code>" <tr> <td>"<code>latin6</code>" <tr> <td rowspan="3"><a data-link-type="dfn" href="#iso-8859-13" id="ref-for-iso-8859-13">ISO-8859-13</a> <td>"<code>iso-8859-13</code>" <tr> <td>"<code>iso8859-13</code>" <tr> <td>"<code>iso885913</code>" <tr> <td rowspan="3"><a data-link-type="dfn" href="#iso-8859-14" id="ref-for-iso-8859-14">ISO-8859-14</a> <td>"<code>iso-8859-14</code>" <tr> <td>"<code>iso8859-14</code>" <tr> <td>"<code>iso885914</code>" <tr> <td rowspan="6"><a data-link-type="dfn" href="#iso-8859-15" id="ref-for-iso-8859-15">ISO-8859-15</a> <td>"<code>csisolatin9</code>" <tr> <td>"<code>iso-8859-15</code>" <tr> <td>"<code>iso8859-15</code>" <tr> <td>"<code>iso885915</code>" <tr> <td>"<code>iso_8859-15</code>" <tr> <td>"<code>l9</code>" <tr> <td><a data-link-type="dfn" href="#iso-8859-16" id="ref-for-iso-8859-16">ISO-8859-16</a> <td>"<code>iso-8859-16</code>" <tr> <td rowspan="5"><a data-link-type="dfn" href="#koi8-r" id="ref-for-koi8-r">KOI8-R</a> <td>"<code>cskoi8r</code>" <tr> <td>"<code>koi</code>" <tr> <td>"<code>koi8</code>" <tr> <td>"<code>koi8-r</code>" <tr> <td>"<code>koi8_r</code>" <tr> <td rowspan="2"><a data-link-type="dfn" href="#koi8-u" id="ref-for-koi8-u">KOI8-U</a> <td>"<code>koi8-ru</code>" <tr> <td>"<code>koi8-u</code>" <tr> <td rowspan="4"><a data-link-type="dfn" href="#macintosh" id="ref-for-macintosh">macintosh</a> <td>"<code>csmacintosh</code>" <tr> <td>"<code>mac</code>" <tr> <td>"<code>macintosh</code>" <tr> <td>"<code>x-mac-roman</code>" <tr> <td rowspan="6"><a data-link-type="dfn" href="#windows-874" id="ref-for-windows-874">windows-874</a> <td>"<code>dos-874</code>" <tr> <td>"<code>iso-8859-11</code>" <tr> <td>"<code>iso8859-11</code>" <tr> <td>"<code>iso885911</code>" <tr> <td>"<code>tis-620</code>" <tr> <td>"<code>windows-874</code>" <tr> <td rowspan="3"><a data-link-type="dfn" href="#windows-1250" id="ref-for-windows-1250">windows-1250</a> <td>"<code>cp1250</code>" <tr> <td>"<code>windows-1250</code>" <tr> <td>"<code>x-cp1250</code>" <tr> <td rowspan="3"><a data-link-type="dfn" href="#windows-1251" id="ref-for-windows-1251">windows-1251</a> <td>"<code>cp1251</code>" <tr> <td>"<code>windows-1251</code>" <tr> <td>"<code>x-cp1251</code>" <tr> <td rowspan="17"><a data-link-type="dfn" href="#windows-1252" id="ref-for-windows-1252①">windows-1252</a> <td>"<code>ansi_x3.4-1968</code>" <tr> <td>"<code>ascii</code>" <tr> <td>"<code>cp1252</code>" <tr> <td>"<code>cp819</code>" <tr> <td>"<code>csisolatin1</code>" <tr> <td>"<code>ibm819</code>" <tr> <td>"<code>iso-8859-1</code>" <tr> <td>"<code>iso-ir-100</code>" <tr> <td>"<code>iso8859-1</code>" <tr> <td>"<code>iso88591</code>" <tr> <td>"<code>iso_8859-1</code>" <tr> <td>"<code>iso_8859-1:1987</code>" <tr> <td>"<code>l1</code>" <tr> <td>"<code>latin1</code>" <tr> <td>"<code>us-ascii</code>" <tr> <td>"<code>windows-1252</code>" <tr> <td>"<code>x-cp1252</code>" <tr> <td rowspan="3"><a data-link-type="dfn" href="#windows-1253" id="ref-for-windows-1253">windows-1253</a> <td>"<code>cp1253</code>" <tr> <td>"<code>windows-1253</code>" <tr> <td>"<code>x-cp1253</code>" <tr> <td rowspan="12"><a data-link-type="dfn" href="#windows-1254" id="ref-for-windows-1254">windows-1254</a> <td>"<code>cp1254</code>" <tr> <td>"<code>csisolatin5</code>" <tr> <td>"<code>iso-8859-9</code>" <tr> <td>"<code>iso-ir-148</code>" <tr> <td>"<code>iso8859-9</code>" <tr> <td>"<code>iso88599</code>" <tr> <td>"<code>iso_8859-9</code>" <tr> <td>"<code>iso_8859-9:1989</code>" <tr> <td>"<code>l5</code>" <tr> <td>"<code>latin5</code>" <tr> <td>"<code>windows-1254</code>" <tr> <td>"<code>x-cp1254</code>" <tr> <td rowspan="3"><a data-link-type="dfn" href="#windows-1255" id="ref-for-windows-1255">windows-1255</a> <td>"<code>cp1255</code>" <tr> <td>"<code>windows-1255</code>" <tr> <td>"<code>x-cp1255</code>" <tr> <td rowspan="3"><a data-link-type="dfn" href="#windows-1256" id="ref-for-windows-1256">windows-1256</a> <td>"<code>cp1256</code>" <tr> <td>"<code>windows-1256</code>" <tr> <td>"<code>x-cp1256</code>" <tr> <td rowspan="3"><a data-link-type="dfn" href="#windows-1257" id="ref-for-windows-1257">windows-1257</a> <td>"<code>cp1257</code>" <tr> <td>"<code>windows-1257</code>" <tr> <td>"<code>x-cp1257</code>" <tr> <td rowspan="3"><a data-link-type="dfn" href="#windows-1258" id="ref-for-windows-1258">windows-1258</a> <td>"<code>cp1258</code>" <tr> <td>"<code>windows-1258</code>" <tr> <td>"<code>x-cp1258</code>" <tr> <td rowspan="2"><a data-link-type="dfn" href="#x-mac-cyrillic" id="ref-for-x-mac-cyrillic">x-mac-cyrillic</a> <td>"<code>x-mac-cyrillic</code>" <tr> <td>"<code>x-mac-ukrainian</code>" <tbody> <tr> <th colspan="2"><a href="#legacy-multi-byte-chinese-(simplified)-encodings">Legacy multi-byte Chinese (simplified) encodings</a> <tr> <td rowspan="9"><a data-link-type="dfn" href="#gbk" id="ref-for-gbk">GBK</a> <td>"<code>chinese</code>" <tr> <td>"<code>csgb2312</code>" <tr> <td>"<code>csiso58gb231280</code>" <tr> <td>"<code>gb2312</code>" <tr> <td>"<code>gb_2312</code>" <tr> <td>"<code>gb_2312-80</code>" <tr> <td>"<code>gbk</code>" <tr> <td>"<code>iso-ir-58</code>" <tr> <td>"<code>x-gbk</code>" <tr> <td><a data-link-type="dfn" href="#gb18030" id="ref-for-gb18030">gb18030</a> <td>"<code>gb18030</code>" <tbody> <tr> <th colspan="2"><a href="#legacy-multi-byte-chinese-(traditional)-encodings">Legacy multi-byte Chinese (traditional) encodings</a> <tr> <td rowspan="5"><a data-link-type="dfn" href="#big5" id="ref-for-big5">Big5</a> <td>"<code>big5</code>" <tr> <td>"<code>big5-hkscs</code>" <tr> <td>"<code>cn-big5</code>" <tr> <td>"<code>csbig5</code>" <tr> <td>"<code>x-x-big5</code>" <tbody> <tr> <th colspan="2"><a href="#legacy-multi-byte-japanese-encodings">Legacy multi-byte Japanese encodings</a> <tr> <td rowspan="3"><a data-link-type="dfn" href="#euc-jp" id="ref-for-euc-jp">EUC-JP</a> <td>"<code>cseucpkdfmtjapanese</code>" <tr> <td>"<code>euc-jp</code>" <tr> <td>"<code>x-euc-jp</code>" <tr> <td rowspan="2"><a data-link-type="dfn" href="#iso-2022-jp" id="ref-for-iso-2022-jp①">ISO-2022-JP</a> <td>"<code>csiso2022jp</code>" <tr> <td>"<code>iso-2022-jp</code>" <tr> <td rowspan="8"><a data-link-type="dfn" href="#shift_jis" id="ref-for-shift_jis①">Shift_JIS</a> <td>"<code>csshiftjis</code>" <tr> <td>"<code>ms932</code>" <tr> <td>"<code>ms_kanji</code>" <tr> <td>"<code>shift-jis</code>" <tr> <td>"<code>shift_jis</code>" <tr> <td>"<code>sjis</code>" <tr> <td>"<code>windows-31j</code>" <tr> <td>"<code>x-sjis</code>" <tbody> <tr> <th colspan="2"><a href="#legacy-multi-byte-korean-encodings">Legacy multi-byte Korean encodings</a> <tr> <td rowspan="10"><a data-link-type="dfn" href="#euc-kr" id="ref-for-euc-kr">EUC-KR</a> <td>"<code>cseuckr</code>" <tr> <td>"<code>csksc56011987</code>" <tr> <td>"<code>euc-kr</code>" <tr> <td>"<code>iso-ir-149</code>" <tr> <td>"<code>korean</code>" <tr> <td>"<code>ks_c_5601-1987</code>" <tr> <td>"<code>ks_c_5601-1989</code>" <tr> <td>"<code>ksc5601</code>" <tr> <td>"<code>ksc_5601</code>" <tr> <td>"<code>windows-949</code>" <tbody> <tr> <th colspan="2"><a href="#legacy-miscellaneous-encodings">Legacy miscellaneous encodings</a> <tr> <td rowspan="6"><a data-link-type="dfn" href="#replacement" id="ref-for-replacement②">replacement</a> <td>"<code>csiso2022kr</code>" <tr> <td>"<code>hz-gb-2312</code>" <tr> <td>"<code>iso-2022-cn</code>" <tr> <td>"<code>iso-2022-cn-ext</code>" <tr> <td>"<code>iso-2022-kr</code>" <tr> <td>"<code>replacement</code>" <tr> <td rowspan="2"><a data-link-type="dfn" href="#utf-16be" id="ref-for-utf-16be②">UTF-16BE</a> <td>"<code>unicodefffe</code>" <tr> <td>"<code>utf-16be</code>" <tr> <td rowspan="7"><a data-link-type="dfn" href="#utf-16le" id="ref-for-utf-16le②">UTF-16LE</a> <td>"<code>csunicode</code>" <tr> <td>"<code>iso-10646-ucs-2</code>" <tr> <td>"<code>ucs-2</code>" <tr> <td>"<code>unicode</code>" <tr> <td>"<code>unicodefeff</code>" <tr> <td>"<code>utf-16</code>" <tr> <td>"<code>utf-16le</code>" <tr> <td><a data-link-type="dfn" href="#x-user-defined" id="ref-for-x-user-defined">x-user-defined</a> <td>"<code>x-user-defined</code>" </table> <p class="note" role="note">All <a data-link-type="dfn" href="#encoding" id="ref-for-encoding①⑥">encodings</a> and their <a data-link-type="dfn" href="#label" id="ref-for-label⑤">labels</a> are also available as non-normative <a href="encodings.json">encodings.json</a> resource. </p> <p class="note" id="supported-encodings" role="note"><a class="self-link" href="#supported-encodings"></a>The set of supported <a data-link-type="dfn" href="#encoding" id="ref-for-encoding①⑦">encodings</a> is primarily based on the intersection of the sets supported by major browser engines when the development of this standard started, while removing encodings that were rarely used legitimately but that could be used in attacks. The inclusion of some encodings is questionable in the light of anecdotal evidence of the level of use by existing Web content. That is, while they have been broadly supported by browsers, it is unclear if they are broadly used by Web content. However, an effort has not been made to eagerly remove <a data-link-type="dfn" href="#single-byte-encoding" id="ref-for-single-byte-encoding">single-byte encodings</a> that were broadly supported by browsers or are part of the ISO 8859 series. In particular, the necessity of the inclusion of <a data-link-type="dfn" href="#ibm866" id="ref-for-ibm866①">IBM866</a>, <a data-link-type="dfn" href="#macintosh" id="ref-for-macintosh①">macintosh</a>, <a data-link-type="dfn" href="#x-mac-cyrillic" id="ref-for-x-mac-cyrillic①">x-mac-cyrillic</a>, <a data-link-type="dfn" href="#iso-8859-3" id="ref-for-iso-8859-3①">ISO-8859-3</a>, <a data-link-type="dfn" href="#iso-8859-10" id="ref-for-iso-8859-10①">ISO-8859-10</a>, <a data-link-type="dfn" href="#iso-8859-14" id="ref-for-iso-8859-14①">ISO-8859-14</a>, and <a data-link-type="dfn" href="#iso-8859-16" id="ref-for-iso-8859-16①">ISO-8859-16</a> is doubtful for the purpose of supporting existing content, but there are no plans to remove these.</p> <h3 class="heading settled" data-level="4.3" id="output-encodings"><span class="secno">4.3. </span><span class="content">Output encodings</span><a class="self-link" href="#output-encodings"></a></h3> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="get-an-output-encoding">get an output encoding</dfn> from an <a data-link-type="dfn" href="#encoding" id="ref-for-encoding①⑧">encoding</a> <var>encoding</var>, run these steps: </p> <ol> <li> <p>If <var>encoding</var> is <a data-link-type="dfn" href="#replacement" id="ref-for-replacement③">replacement</a> or <a data-link-type="dfn" href="#utf-16be-le" id="ref-for-utf-16be-le②">UTF-16BE/LE</a>, then return <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8⑥">UTF-8</a>. </p> <li> <p>Return <var>encoding</var>. </p> </ol> <p class="note" role="note">The <a data-link-type="dfn" href="#get-an-output-encoding" id="ref-for-get-an-output-encoding">get an output encoding</a> algorithm is useful for URL parsing and HTML form submission, which both need exactly this. </p> <h2 class="heading settled" data-level="5" id="indexes"><span class="secno">5. </span><span class="content">Indexes</span><a class="self-link" href="#indexes"></a></h2> <p>Most legacy <a data-link-type="dfn" href="#encoding" id="ref-for-encoding①⑨">encodings</a> make use of an <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="index">index</dfn>. An <a data-link-type="dfn" href="#index" id="ref-for-index">index</a> is an ordered list of entries, each entry consisting of a pointer and a corresponding code point. Within an <a data-link-type="dfn" href="#index" id="ref-for-index①">index</a> pointers are unique and code points can be duplicated. </p> <p class="note no-backref" role="note">An efficient implementation likely has two <a data-link-type="dfn" href="#index" id="ref-for-index②">indexes</a> per <a data-link-type="dfn" href="#encoding" id="ref-for-encoding②⓪">encoding</a>. One optimized for its <a data-link-type="dfn" href="#decoder" id="ref-for-decoder⑥">decoder</a> and one for its <a data-link-type="dfn" href="#encoder" id="ref-for-encoder⑧">encoder</a>. </p> <p>To find the pointers and their corresponding code points in an <a data-link-type="dfn" href="#index" id="ref-for-index③">index</a>, let <var>lines</var> be the result of splitting the resource’s contents on U+000A. Then remove each item in <var>lines</var> that is the empty string or starts with U+0023. Then the pointers and their corresponding code points are found by splitting each item in <var>lines</var> on U+0009. The first subitem is the pointer (as a decimal number) and the second is the corresponding code point (as a hexadecimal number). Other subitems are not relevant. </p> <p class="note no-backref" role="note">To signify changes an <a data-link-type="dfn" href="#index" id="ref-for-index④">index</a> includes an <i>Identifier</i> and a <i>Date</i>. If an <i>Identifier</i> has changed, so has the <a data-link-type="dfn" href="#index" id="ref-for-index⑤">index</a>. </p> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="index-code-point">index code point</dfn> for <var>pointer</var> in <var>index</var> is the code point corresponding to <var>pointer</var> in <var>index</var>, or null if <var>pointer</var> is not in <var>index</var>. </p> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="index-pointer">index pointer</dfn> for <var>code point</var> in <var>index</var> is the <em>first</em> pointer corresponding to <var>code point</var> in <var>index</var>, or null if <var>code point</var> is not in <var>index</var>. </p> <div class="note" id="visualization" role="note"> <a class="self-link" href="#visualization"></a> <p>There is a non-normative visualization for each <a data-link-type="dfn" href="#index" id="ref-for-index⑥">index</a> other than <a data-link-type="dfn" href="#index-gb18030-ranges" id="ref-for-index-gb18030-ranges">index gb18030 ranges</a> and <a data-link-type="dfn" href="#index-iso-2022-jp-katakana" id="ref-for-index-iso-2022-jp-katakana">index ISO-2022-JP katakana</a>. <a data-link-type="dfn" href="#index-jis0208" id="ref-for-index-jis0208">index jis0208</a> also has an alternative <a data-link-type="dfn" href="#shift_jis" id="ref-for-shift_jis②">Shift_JIS</a> visualization. Additionally, there is visualization of the Basic Multilingual Plane coverage of each index other than <a data-link-type="dfn" href="#index-gb18030-ranges" id="ref-for-index-gb18030-ranges①">index gb18030 ranges</a> and <a data-link-type="dfn" href="#index-iso-2022-jp-katakana" id="ref-for-index-iso-2022-jp-katakana①">index ISO-2022-JP katakana</a>. </p> <p>The legend for the visualizations is: </p> <ul class="visualizationlegend"> <li class="unmapped">Unmapped <li class="mid">Two bytes in UTF-8 <li class="mid contiguous">Two bytes in UTF-8, code point follows immediately the code point of previous pointer <li class="upper">Three bytes in UTF-8 (non-PUA) <li class="upper contiguous">Three bytes in UTF-8 (non-PUA), code point follows immediately the code point of previous pointer <li class="pua">Private Use <li class="pua contiguous">Private Use, code point follows immediately the code point of previous pointer <li class="astral">Four bytes in UTF-8 <li class="astral contiguous">Four bytes in UTF-8, code point follows immediately the code point of previous pointer <li class="duplicate">Duplicate code point already mapped at an earlier index <li class="compatibility">CJK Compatibility Ideograph <li class="ext">CJK Unified Ideographs Extension A </ul> </div> <p>These are the <a data-link-type="dfn" href="#index" id="ref-for-index⑦">indexes</a> defined by this specification, excluding <a data-link-type="dfn" href="#index-single-byte" id="ref-for-index-single-byte">index single-byte</a>, which have their own table: </p> <table> <tbody> <tr> <th colspan="4"><a data-link-type="dfn" href="#index" id="ref-for-index⑧">Index</a> <th>Notes <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="index-big5">index Big5</dfn> <td><a href="index-big5.txt">index-big5.txt</a> <td><a href="big5.html">index Big5 visualization</a> <td><a href="big5-bmp.html">index Big5 BMP coverage</a> <td>This matches the Big5 standard in combination with the Hong Kong Supplementary Character Set and other common extensions. <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="index-euc-kr">index EUC-KR</dfn> <td><a href="index-euc-kr.txt">index-euc-kr.txt</a> <td><a href="euc-kr.html">index EUC-KR visualization</a> <td><a href="euc-kr-bmp.html">index EUC-KR BMP coverage</a> <td>This matches the KS X 1001 standard and the Unified Hangul Code, more commonly known together as Windows Codepage 949. It covers the Hangul Syllables block of Unicode in its entirety. The Hangul block whose top left corner in the visualization is at pointer 9026 is in the Unicode order. Taken separately, the rest of the Hangul syllables in this index are in the Unicode order, too. <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="index-gb18030">index gb18030</dfn> <td><a href="index-gb18030.txt">index-gb18030.txt</a> <td><a href="gb18030.html">index gb18030 visualization</a> <td><a href="gb18030-bmp.html">index gb18030 BMP coverage</a> <td>This matches the GB18030-2022 standard for code points encoded as two bytes, except for 0xA3 0xA0 which maps to U+3000 to be compatible with deployed content. This index covers the CJK Unified Ideographs block of Unicode in its entirety. Entries from that block that are above or to the left of (the first) U+3000 in the visualization are in the Unicode order. <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="index-gb18030-ranges">index gb18030 ranges</dfn> <td colspan="3"><a href="index-gb18030-ranges.txt">index-gb18030-ranges.txt</a> <td>This <a data-link-type="dfn" href="#index" id="ref-for-index⑨">index</a> works different from all others. Listing all code points would result in over a million items whereas they can be represented neatly in 207 ranges combined with trivial limit checks. It therefore only superficially matches the GB18030-2000 standard for code points encoded as four bytes. The change for the GB18030-2005 revision is handled inline by the <a data-link-type="dfn" href="#index-gb18030-ranges-code-point" id="ref-for-index-gb18030-ranges-code-point">index gb18030 ranges code point</a> and <a data-link-type="dfn" href="#index-gb18030-ranges-pointer" id="ref-for-index-gb18030-ranges-pointer">index gb18030 ranges pointer</a> algorithms below that accompany this index. And the changes for the GB18030-2022 revision are handled differently again to not further increase the number of byte sequences mapping to Private Use code points. The relevant Private Use code points are mapped in the <a data-link-type="dfn" href="#gb18030-encoder" id="ref-for-gb18030-encoder">gb18030 encoder</a> directly through a side table to preserve compatibility with how they were mapped before. <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="index-jis0208">index jis0208</dfn> <td><a href="index-jis0208.txt">index-jis0208.txt</a> <td><a href="jis0208.html">index jis0208 visualization</a>, <a href="shift_jis.html">Shift_JIS visualization</a> <td><a href="jis0208-bmp.html">index jis0208 BMP coverage</a> <td>This is the JIS X 0208 standard including formerly proprietary extensions from IBM and NEC. <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="index-jis0212">index jis0212</dfn> <td><a href="index-jis0212.txt">index-jis0212.txt</a> <td><a href="jis0212.html">index jis0212 visualization</a> <td><a href="jis0212-bmp.html">index jis0212 BMP coverage</a> <td>This is the JIS X 0212 standard. It is only used by the <a data-link-type="dfn" href="#euc-jp-decoder" id="ref-for-euc-jp-decoder">EUC-JP decoder</a> due to lack of widespread support elsewhere. <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="index-iso-2022-jp-katakana">index ISO-2022-JP katakana</dfn> <td colspan="3"><a href="index-iso-2022-jp-katakana.txt">index-iso-2022-jp-katakana.txt</a> <td>This maps halfwidth to fullwidth katakana as per Unicode Normalization Form KC, except that U+FF9E and U+FF9F map to U+309B and U+309C rather than U+3099 and U+309A. It is only used by the <a data-link-type="dfn" href="#iso-2022-jp-encoder" id="ref-for-iso-2022-jp-encoder">ISO-2022-JP encoder</a>. <a data-link-type="biblio" href="#biblio-unicode" title="The Unicode Standard">[UNICODE]</a> </table> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="index-gb18030-ranges-code-point">index gb18030 ranges code point</dfn> for <var>pointer</var> is the return value of these steps: </p> <ol> <li> <p>If <var>pointer</var> is greater than 39419 and less than 189000, or <var>pointer</var> is greater than 1237575, return null. </p> <li> <p>If <var>pointer</var> is 7457, return code point U+E7C7. </p> <li> <p>Let <var>offset</var> be the last pointer in <a data-link-type="dfn" href="#index-gb18030-ranges" id="ref-for-index-gb18030-ranges②">index gb18030 ranges</a> that is less than or equal to <var>pointer</var> and let <var>code point offset</var> be its corresponding code point. </p> <li> <p>Return a code point whose value is <var>code point offset</var> + <var>pointer</var> − <var>offset</var>. </p> </ol> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="index-gb18030-ranges-pointer">index gb18030 ranges pointer</dfn> for <var>code point</var> is the return value of these steps: </p> <ol> <li> <p>If <var>code point</var> is U+E7C7, return pointer 7457. </p> <li> <p>Let <var>offset</var> be the last code point in <a data-link-type="dfn" href="#index-gb18030-ranges" id="ref-for-index-gb18030-ranges③">index gb18030 ranges</a> that is less than or equal to <var>code point</var> and let <var>pointer offset</var> be its corresponding pointer. </p> <li> <p>Return a pointer whose value is <var>pointer offset</var> + <var>code point</var> − <var>offset</var>. </p> </ol> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="index-shift_jis-pointer">index Shift_JIS pointer</dfn> for <var>code point</var> is the return value of these steps: </p> <ol> <li> <p>Let <var>index</var> be <a data-link-type="dfn" href="#index-jis0208" id="ref-for-index-jis0208①">index jis0208</a> excluding all entries whose pointer is in the range 8272 to 8835, inclusive. </p> <p class="note" role="note">The <a data-link-type="dfn" href="#index-jis0208" id="ref-for-index-jis0208②">index jis0208</a> contains duplicate code points so the exclusion of these entries causes later code points to be used. </p> <li> <p>Return the <a data-link-type="dfn" href="#index-pointer" id="ref-for-index-pointer">index pointer</a> for <var>code point</var> in <var>index</var>. </p> </ol> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="index-big5-pointer">index Big5 pointer</dfn> for <var>code point</var> is the return value of these steps: </p> <ol> <li> <p>Let <var>index</var> be <a data-link-type="dfn" href="#index-big5" id="ref-for-index-big5">index Big5</a> excluding all entries whose pointer is less than (0xA1 - 0x81) × 157. </p> <p class="note" role="note">Avoid returning Hong Kong Supplementary Character Set extensions literally. </p> <li> <p>If <var>code point</var> is U+2550, U+255E, U+2561, U+256A, U+5341, or U+5345, return the <em>last</em> pointer corresponding to <var>code point</var> in <var>index</var>. </p> <p class="note" role="note">There are other duplicate code points, but for those the <em>first</em> pointer is to be used. </p> <li> <p>Return the <a data-link-type="dfn" href="#index-pointer" id="ref-for-index-pointer①">index pointer</a> for <var>code point</var> in <var>index</var>. </p> </ol> <hr> <p class="note no-backref" role="note">All <a data-link-type="dfn" href="#index" id="ref-for-index①⓪">indexes</a> are also available as a non-normative <a href="indexes.json">indexes.json</a> resource. (<a data-link-type="dfn" href="#index-gb18030-ranges" id="ref-for-index-gb18030-ranges④">Index gb18030 ranges</a> has a slightly different format here, to be able to represent ranges.) </p> <h2 class="heading settled" data-level="6" id="specification-hooks"><span class="secno">6. </span><span class="content">Hooks for standards</span><a class="self-link" href="#specification-hooks"></a></h2> <div class="note" role="note"> <p>The algorithms defined below (<a data-link-type="dfn" href="#utf-8-decode" id="ref-for-utf-8-decode①">UTF-8 decode</a>, <a data-link-type="dfn" href="#utf-8-decode-without-bom" id="ref-for-utf-8-decode-without-bom">UTF-8 decode without BOM</a>, <a data-link-type="dfn" href="#utf-8-decode-without-bom-or-fail" id="ref-for-utf-8-decode-without-bom-or-fail">UTF-8 decode without BOM or fail</a>, and <a data-link-type="dfn" href="#utf-8-encode" id="ref-for-utf-8-encode">UTF-8 encode</a>) are intended for usage by other standards. </p> <p>For decoding, <a data-link-type="dfn" href="#utf-8-decode" id="ref-for-utf-8-decode②">UTF-8 decode</a> is to be used by new formats. For identifiers or byte sequences within a format or protocol, use <a data-link-type="dfn" href="#utf-8-decode-without-bom" id="ref-for-utf-8-decode-without-bom①">UTF-8 decode without BOM</a> or <a data-link-type="dfn" href="#utf-8-decode-without-bom-or-fail" id="ref-for-utf-8-decode-without-bom-or-fail①">UTF-8 decode without BOM or fail</a>. </p> <p>For encoding, <a data-link-type="dfn" href="#utf-8-encode" id="ref-for-utf-8-encode①">UTF-8 encode</a> is to be used. </p> <p>Standards are to ensure that the input I/O queues they pass to <a data-link-type="dfn" href="#utf-8-encode" id="ref-for-utf-8-encode②">UTF-8 encode</a> (as well as the legacy <a data-link-type="dfn" href="#encode" id="ref-for-encode">encode</a>) are effectively I/O queues of scalar values, i.e., they contain no <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#surrogate" id="ref-for-surrogate②">surrogates</a>. </p> <p>These hooks (as well as <a data-link-type="dfn" href="#decode" id="ref-for-decode">decode</a> and <a data-link-type="dfn" href="#encode" id="ref-for-encode①">encode</a>) will block until the input I/O queue has been consumed in its entirety. In order to use the output tokens as they are pushed into the stream, callers are to invoke the hooks with an empty output I/O queue and read from it <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel" id="ref-for-in-parallel①">in parallel</a>. Note that some care is needed when using <a data-link-type="dfn" href="#utf-8-decode-without-bom-or-fail" id="ref-for-utf-8-decode-without-bom-or-fail②">UTF-8 decode without BOM or fail</a>, as any error found during decoding will prevent the <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream①⑦">end-of-queue</a> item from ever being pushed into the output I/O queue. </p> </div> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="utf-8-decode">UTF-8 decode</dfn> an I/O queue of bytes <var>ioQueue</var> given an optional I/O queue of scalar values <var>output</var> (default « »), run these steps: </p> <ol> <li> <p>Let <var>buffer</var> be the result of <a data-link-type="dfn" href="#i-o-queue-peek" id="ref-for-i-o-queue-peek">peeking</a> three bytes from <var>ioQueue</var>, converted to a byte sequence. </p> <li> <p>If <var>buffer</var> is 0xEF 0xBB 0xBF, then <a data-link-type="dfn" href="#concept-stream-read" id="ref-for-concept-stream-read⑤">read</a> three bytes from <var>ioQueue</var>. (Do nothing with those bytes.) </p> <li> <p><a data-link-type="dfn" href="#concept-encoding-run" id="ref-for-concept-encoding-run">Process a queue</a> with an instance of <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8⑦">UTF-8</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder⑦">decoder</a>, <var>ioQueue</var>, <var>output</var>, and "<code>replacement</code>". </p> <li> <p>Return <var>output</var>. </p> </ol> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="utf-8-decode-without-bom">UTF-8 decode without BOM</dfn> an I/O queue of bytes <var>ioQueue</var> given an optional I/O queue of scalar values <var>output</var> (default « »), run these steps: </p> <ol> <li> <p><a data-link-type="dfn" href="#concept-encoding-run" id="ref-for-concept-encoding-run①">Process a queue</a> with an instance of <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8⑧">UTF-8</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder⑧">decoder</a>, <var>ioQueue</var>, <var>output</var>, and "<code>replacement</code>". </p> <li> <p>Return <var>output</var>. </p> </ol> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="utf-8-decode-without-bom-or-fail">UTF-8 decode without BOM or fail</dfn> an I/O queue of bytes <var>ioQueue</var> given an optional I/O queue of scalar values <var>output</var> (default « »), run these steps: </p> <ol> <li> <p>Let <var>potentialError</var> be the result of <a data-link-type="dfn" href="#concept-encoding-run" id="ref-for-concept-encoding-run②">processing a queue</a> with an instance of <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8⑨">UTF-8</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder⑨">decoder</a>, <var>ioQueue</var>, <var>output</var>, and "<code>fatal</code>". </p> <li> <p>If <var>potentialError</var> is an <a data-link-type="dfn" href="#error" id="ref-for-error①">error</a>, then return failure. </p> <li> <p>Return <var>output</var>. </p> </ol> <hr> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="utf-8-encode">UTF-8 encode</dfn> an I/O queue of scalar values <var>ioQueue</var> given an optional I/O queue of bytes <var>output</var> (default « »), return the result of <a data-link-type="dfn" href="#encode" id="ref-for-encode②">encoding</a> <var>ioQueue</var> with encoding <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8①⓪">UTF-8</a> and <var>output</var>. </p> <h3 class="heading settled" data-level="6.1" id="legacy-hooks"><span class="secno">6.1. </span><span class="content">Legacy hooks for standards</span><a class="self-link" href="#legacy-hooks"></a></h3> <div class="note" role="note"> <p>Standards are strongly discouraged from using <a data-link-type="dfn" href="#decode" id="ref-for-decode①">decode</a>, <a data-link-type="dfn" href="#bom-sniff" id="ref-for-bom-sniff">BOM sniff</a>, and <a data-link-type="dfn" href="#encode" id="ref-for-encode③">encode</a>, except as needed for compatibility. Standards needing these legacy hooks will most likely also need to use <a data-link-type="dfn" href="#concept-encoding-get" id="ref-for-concept-encoding-get">get an encoding</a> (to turn a label into an <a data-link-type="dfn" href="#encoding" id="ref-for-encoding②①">encoding</a>) and <a data-link-type="dfn" href="#get-an-output-encoding" id="ref-for-get-an-output-encoding①">get an output encoding</a> (to turn an <a data-link-type="dfn" href="#encoding" id="ref-for-encoding②②">encoding</a> into another <a data-link-type="dfn" href="#encoding" id="ref-for-encoding②③">encoding</a> that is suitable to pass into <a data-link-type="dfn" href="#encode" id="ref-for-encode④">encode</a>). </p> <p>For the extremely niche case of URL percent-encoding, custom encoder error handling is needed. The <a data-link-type="dfn" href="#get-an-encoder" id="ref-for-get-an-encoder">get an encoder</a> and <a data-link-type="dfn" href="#encode-or-fail" id="ref-for-encode-or-fail">encode or fail</a> algorithms are to be used for that. Other algorithms are not to be used directly. </p> </div> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="decode">decode</dfn> an I/O queue of bytes <var>ioQueue</var> given a fallback encoding <var>encoding</var> and an optional I/O queue of scalar values <var>output</var> (default « »), run these steps: </p> <ol> <li> <p>Let <var>BOMEncoding</var> be the result of <a data-link-type="dfn" href="#bom-sniff" id="ref-for-bom-sniff①">BOM sniffing</a> <var>ioQueue</var>. </p> <li> <p>If <var>BOMEncoding</var> is non-null: </p> <ol> <li> <p>Set <var>encoding</var> to <var>BOMEncoding</var>. </p> <li> <p><a data-link-type="dfn" href="#concept-stream-read" id="ref-for-concept-stream-read⑥">Read</a> three bytes from <var>ioQueue</var>, if <var>BOMEncoding</var> is <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8①①">UTF-8</a>; otherwise <a data-link-type="dfn" href="#concept-stream-read" id="ref-for-concept-stream-read⑦">read</a> two bytes. (Do nothing with those bytes.) </p> </ol> <p class="note" role="note">For compatibility with deployed content, the byte order mark is more authoritative than anything else. In a context where HTTP is used this is in violation of the semantics of the `<code>Content-Type</code>` header. </p> <li> <p><a data-link-type="dfn" href="#concept-encoding-run" id="ref-for-concept-encoding-run③">Process a queue</a> with an instance of <var>encoding</var>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder①⓪">decoder</a>, <var>ioQueue</var>, <var>output</var>, and "<code>replacement</code>". </p> <li> <p>Return <var>output</var>. </p> </ol> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="bom-sniff">BOM sniff</dfn> an I/O queue of bytes <var>ioQueue</var>, run these steps: </p> <ol> <li> <p>Let <var>BOM</var> be the result of <a data-link-type="dfn" href="#i-o-queue-peek" id="ref-for-i-o-queue-peek①">peeking</a> 3 bytes from <var>ioQueue</var>, converted to a byte sequence. </p> <li> <p>For each of the rows in the table below, starting with the first one and going down, if <var>BOM</var> <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence-starts-with" id="ref-for-byte-sequence-starts-with">starts with</a> the bytes given in the first column, then return the <a data-link-type="dfn" href="#encoding" id="ref-for-encoding②④">encoding</a> given in the cell in the second column of that row. Otherwise, return null. </p> <table> <tbody> <tr> <th>Byte order mark <th>Encoding <tr> <td>0xEF 0xBB 0xBF <td><a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8①②">UTF-8</a> <tr> <td>0xFE 0xFF <td><a data-link-type="dfn" href="#utf-16be" id="ref-for-utf-16be③">UTF-16BE</a> <tr> <td>0xFF 0xFE <td><a data-link-type="dfn" href="#utf-16le" id="ref-for-utf-16le③">UTF-16LE</a> </table> </ol> <p class="note" role="note">This hook is a workaround for the fact that <a data-link-type="dfn" href="#decode" id="ref-for-decode②">decode</a> has no way to communicate back to the caller that it has found a byte order mark and is therefore not using the provided encoding. The hook is to be invoked before <a data-link-type="dfn" href="#decode" id="ref-for-decode③">decode</a>, and it will return an encoding corresponding to the byte order mark found, or null otherwise. </p> <hr> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="encode">encode</dfn> an I/O queue of scalar values <var>ioQueue</var> given an encoding <var>encoding</var> and an optional I/O queue of bytes <var>output</var> (default « »), run these steps: </p> <ol> <li> <p>Let <var>encoder</var> be the result of <a data-link-type="dfn" href="#get-an-encoder" id="ref-for-get-an-encoder①">getting an encoder</a> from <var>encoding</var>. </p> <li> <p><a data-link-type="dfn" href="#concept-encoding-run" id="ref-for-concept-encoding-run④">Process a queue</a> with <var>encoder</var>, <var>ioQueue</var>, <var>output</var>, and "<code>html</code>". </p> <li> <p>Return <var>output</var>. </p> </ol> <p class="note no-backref" role="note">This is a legacy hook for HTML forms. Layering <a data-link-type="dfn" href="#utf-8-encode" id="ref-for-utf-8-encode③">UTF-8 encode</a> on top is safe as it never triggers <a data-link-type="dfn" href="#error" id="ref-for-error②">errors</a>. <a data-link-type="biblio" href="#biblio-html" title="HTML Standard">[HTML]</a> </p> <hr> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="get an encoder|getting an encoder" id="get-an-encoder">get an encoder</dfn> from an <a data-link-type="dfn" href="#encoding" id="ref-for-encoding②⑤">encoding</a> <var>encoding</var>: </p> <ol> <li> <p>Assert: <var>encoding</var> is not <a data-link-type="dfn" href="#replacement" id="ref-for-replacement④">replacement</a> or <a data-link-type="dfn" href="#utf-16be-le" id="ref-for-utf-16be-le③">UTF-16BE/LE</a>. </p> <li> <p>Return an instance of <var>encoding</var>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder⑨">encoder</a>. </p> </ol> <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="encode-or-fail">encode or fail</dfn> an I/O queue of scalar values <var>ioQueue</var> given an <a data-link-type="dfn" href="#encoder" id="ref-for-encoder①⓪">encoder</a> instance <var>encoder</var> and an I/O queue of bytes <var>output</var>, run these steps: </p> <ol> <li> <p>Let <var>potentialError</var> be the result of <a data-link-type="dfn" href="#concept-encoding-run" id="ref-for-concept-encoding-run⑤">processing a queue</a> with <var>encoder</var>, <var>ioQueue</var>, <var>output</var>, and "<code>fatal</code>". </p> <li> <p><a data-link-type="dfn" href="#concept-stream-push" id="ref-for-concept-stream-push⑦">Push</a> <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream①⑧">end-of-queue</a> to <var>output</var>. </p> <li> <p>If <var>potentialError</var> is an <a data-link-type="dfn" href="#error" id="ref-for-error③">error</a>, then return <a data-link-type="dfn" href="#error" id="ref-for-error④">error</a>’s <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point②">code point</a>’s <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point-value" id="ref-for-code-point-value①">value</a>. </p> <li> <p>Return null. </p> </ol> <div class="note" id="pit-of-iso-2022-jp" role="note"> <a class="self-link" href="#pit-of-iso-2022-jp"></a> <p>This is a legacy hook for URL percent-encoding. The caller will have to keep an <a data-link-type="dfn" href="#encoder" id="ref-for-encoder①①">encoder</a> instance alive as the <a data-link-type="dfn" href="#iso-2022-jp-encoder" id="ref-for-iso-2022-jp-encoder①">ISO-2022-JP encoder</a> can be in two different states when returning an <a data-link-type="dfn" href="#error" id="ref-for-error⑤">error</a>. That also means that if the caller emits bytes to encode the error in some way, these have to be in the range 0x00 to 0x7F, inclusive, excluding 0x0E, 0x0F, 0x1B, 0x5C, and 0x7E. <a data-link-type="biblio" href="#biblio-url" title="URL Standard">[URL]</a> </p> <p>In particular, if upon returning an <a data-link-type="dfn" href="#error" id="ref-for-error⑥">error</a> the <a data-link-type="dfn" href="#iso-2022-jp-encoder" id="ref-for-iso-2022-jp-encoder②">ISO-2022-JP encoder</a> is in the <a data-link-type="dfn" href="#iso-2022-jp-decoder-roman" id="ref-for-iso-2022-jp-decoder-roman">Roman</a> state, the caller cannot output 0x5C (\) as it will not decode as U+005C (\). For this reason, applications using <a data-link-type="dfn" href="#encode-or-fail" id="ref-for-encode-or-fail①">encode or fail</a> for unintended purposes ought to take care to prevent the use of the <a data-link-type="dfn" href="#iso-2022-jp-encoder" id="ref-for-iso-2022-jp-encoder③">ISO-2022-JP encoder</a> in combination with replacement schemes, such as those of JavaScript and CSS, that use U+005C (\) as part of the replacement syntax (e.g., <code>\u2603</code>) or make sure to pass the replacement syntax through the encoder (in contrast to URL percent-encoding). </p> <p>The return value is either the number representing the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point③">code point</a> that could not be encoded or null, if there was no <a data-link-type="dfn" href="#error" id="ref-for-error⑦">error</a>. When it returns non-null the caller will have to invoke it again, supplying the same <a data-link-type="dfn" href="#encoder" id="ref-for-encoder①②">encoder</a> instance and a new output I/O queue. </p> </div> <h2 class="heading settled" data-level="7" id="api"><span class="secno">7. </span><span class="content">API</span><a class="self-link" href="#api"></a></h2> <p>This section uses terminology from Web IDL. Browser user agents must support this API. JavaScript implementations should support this API. Other user agents or programming languages are encouraged to use an API suitable to their needs, which might not be this one. <a data-link-type="biblio" href="#biblio-webidl" title="Web IDL Standard">[WEBIDL]</a> </p> <div class="example" id="example-textencoder"> <a class="self-link" href="#example-textencoder"></a> <p>The following example uses the <code class="idl"><a data-link-type="idl" href="#textencoder" id="ref-for-textencoder">TextEncoder</a></code> object to encode an array of strings into an <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer" id="ref-for-idl-ArrayBuffer">ArrayBuffer</a></code>. The result is a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-Uint8Array" id="ref-for-idl-Uint8Array">Uint8Array</a></code> containing the number of strings (as a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-Uint32Array" id="ref-for-idl-Uint32Array">Uint32Array</a></code>), followed by the length of the first string (as a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-Uint32Array" id="ref-for-idl-Uint32Array①">Uint32Array</a></code>), the <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8①③">UTF-8</a> encoded string data, the length of the second string (as a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-Uint32Array" id="ref-for-idl-Uint32Array②">Uint32Array</a></code>), the string data, and so on. </p> <pre><code class="lang-javascript highlight"><c- a>function</c-> encodeArrayOfStrings<c- p>(</c->strings<c- p>)</c-> <c- p>{</c-> <c- a>var</c-> encoder<c- p>,</c-> encoded<c- p>,</c-> len<c- p>,</c-> bytes<c- p>,</c-> view<c- p>,</c-> offset<c- p>;</c-> encoder <c- o>=</c-> <c- ow>new</c-> TextEncoder<c- p>();</c-> encoded <c- o>=</c-> <c- p>[];</c-> len <c- o>=</c-> Uint32Array<c- p>.</c->BYTES_PER_ELEMENT<c- p>;</c-> <c- k>for</c-> <c- p>(</c-><c- a>var</c-> i <c- o>=</c-> <c- mf>0</c-><c- p>;</c-> i <c- o>&lt;</c-> strings<c- p>.</c->length<c- p>;</c-> i<c- o>++</c-><c- p>)</c-> <c- p>{</c-> len <c- o>+=</c-> Uint32Array<c- p>.</c->BYTES_PER_ELEMENT<c- p>;</c-> encoded<c- p>[</c->i<c- p>]</c-> <c- o>=</c-> encoder<c- p>.</c->encode<c- p>(</c->strings<c- p>[</c->i<c- p>]);</c-> len <c- o>+=</c-> encoded<c- p>[</c->i<c- p>].</c->byteLength<c- p>;</c-> <c- p>}</c-> bytes <c- o>=</c-> <c- ow>new</c-> Uint8Array<c- p>(</c->len<c- p>);</c-> view <c- o>=</c-> <c- ow>new</c-> DataView<c- p>(</c->bytes<c- p>.</c->buffer<c- p>);</c-> offset <c- o>=</c-> <c- mf>0</c-><c- p>;</c-> view<c- p>.</c->setUint32<c- p>(</c->offset<c- p>,</c-> strings<c- p>.</c->length<c- p>);</c-> offset <c- o>+=</c-> Uint32Array<c- p>.</c->BYTES_PER_ELEMENT<c- p>;</c-> <c- k>for</c-> <c- p>(</c-><c- a>var</c-> i <c- o>=</c-> <c- mf>0</c-><c- p>;</c-> i <c- o>&lt;</c-> encoded<c- p>.</c->length<c- p>;</c-> i <c- o>+=</c-> <c- mf>1</c-><c- p>)</c-> <c- p>{</c-> len <c- o>=</c-> encoded<c- p>[</c->i<c- p>].</c->byteLength<c- p>;</c-> view<c- p>.</c->setUint32<c- p>(</c->offset<c- p>,</c-> len<c- p>);</c-> offset <c- o>+=</c-> Uint32Array<c- p>.</c->BYTES_PER_ELEMENT<c- p>;</c-> bytes<c- p>.</c->set<c- p>(</c->encoded<c- p>[</c->i<c- p>],</c-> offset<c- p>);</c-> offset <c- o>+=</c-> len<c- p>;</c-> <c- p>}</c-> <c- k>return</c-> bytes<c- p>.</c->buffer<c- p>;</c-> <c- p>}</c-></code></pre> <p>The following example decodes an <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer" id="ref-for-idl-ArrayBuffer①">ArrayBuffer</a></code> containing data encoded in the format produced by the previous example, or an equivalent algorithm for encodings other than <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8①④">UTF-8</a>, back into an array of strings. </p> <pre><code class="lang-javascript highlight"><c- a>function</c-> decodeArrayOfStrings<c- p>(</c->buffer<c- p>,</c-> encoding<c- p>)</c-> <c- p>{</c-> <c- a>var</c-> decoder<c- p>,</c-> view<c- p>,</c-> offset<c- p>,</c-> num_strings<c- p>,</c-> strings<c- p>,</c-> len<c- p>;</c-> decoder <c- o>=</c-> <c- ow>new</c-> TextDecoder<c- p>(</c->encoding<c- p>);</c-> view <c- o>=</c-> <c- ow>new</c-> DataView<c- p>(</c->buffer<c- p>);</c-> offset <c- o>=</c-> <c- mf>0</c-><c- p>;</c-> strings <c- o>=</c-> <c- p>[];</c-> num_strings <c- o>=</c-> view<c- p>.</c->getUint32<c- p>(</c->offset<c- p>);</c-> offset <c- o>+=</c-> Uint32Array<c- p>.</c->BYTES_PER_ELEMENT<c- p>;</c-> <c- k>for</c-> <c- p>(</c-><c- a>var</c-> i <c- o>=</c-> <c- mf>0</c-><c- p>;</c-> i <c- o>&lt;</c-> num_strings<c- p>;</c-> i<c- o>++</c-><c- p>)</c-> <c- p>{</c-> len <c- o>=</c-> view<c- p>.</c->getUint32<c- p>(</c->offset<c- p>);</c-> offset <c- o>+=</c-> Uint32Array<c- p>.</c->BYTES_PER_ELEMENT<c- p>;</c-> strings<c- p>[</c->i<c- p>]</c-> <c- o>=</c-> decoder<c- p>.</c->decode<c- p>(</c-> <c- ow>new</c-> DataView<c- p>(</c->view<c- p>.</c->buffer<c- p>,</c-> offset<c- p>,</c-> len<c- p>));</c-> offset <c- o>+=</c-> len<c- p>;</c-> <c- p>}</c-> <c- k>return</c-> strings<c- p>;</c-> <c- p>}</c-></code></pre> </div> <h3 class="heading settled" data-level="7.1" id="interface-mixin-textdecodercommon"><span class="secno">7.1. </span><span class="content">Interface mixin <code class="idl"><a data-link-type="idl" href="#textdecodercommon" id="ref-for-textdecodercommon">TextDecoderCommon</a></code></span><a class="self-link" href="#interface-mixin-textdecodercommon"></a></h3> <pre class="idl highlight def"><c- b>interface</c-> <c- b>mixin</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="textdecodercommon"><code><c- g>TextDecoderCommon</c-></code></dfn> { <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString"><c- b>DOMString</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="DOMString" href="#dom-textdecoder-encoding" id="ref-for-dom-textdecoder-encoding"><c- g>encoding</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean" id="ref-for-idl-boolean"><c- b>boolean</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="boolean" href="#dom-textdecoder-fatal" id="ref-for-dom-textdecoder-fatal"><c- g>fatal</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean" id="ref-for-idl-boolean①"><c- b>boolean</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="boolean" href="#dom-textdecoder-ignorebom" id="ref-for-dom-textdecoder-ignorebom"><c- g>ignoreBOM</c-></a>; }; </pre> <p>The <code class="idl"><a data-link-type="idl" href="#textdecodercommon" id="ref-for-textdecodercommon①">TextDecoderCommon</a></code> interface mixin defines common getters that are shared between <code class="idl"><a data-link-type="idl" href="#textdecoder" id="ref-for-textdecoder">TextDecoder</a></code> and <code class="idl"><a data-link-type="idl" href="#textdecoderstream" id="ref-for-textdecoderstream">TextDecoderStream</a></code> objects. These objects have an associated: </p> <dl> <dt><dfn class="dfn-paneled" data-dfn-for="TextDecoderCommon" data-dfn-type="dfn" data-noexport id="textdecoder-encoding">encoding</dfn> <dd>An <a data-link-type="dfn" href="#encoding" id="ref-for-encoding②⑥">encoding</a>. <dt><dfn class="dfn-paneled" data-dfn-for="TextDecoderCommon" data-dfn-type="dfn" data-noexport id="textdecodercommon-decoder">decoder<span id="textdecoder-decoder"></span><span id="textdecoderstream-decoder"></span></dfn> <dd>A <a data-link-type="dfn" href="#decoder" id="ref-for-decoder①①">decoder</a> instance. <dt><dfn class="dfn-paneled" data-dfn-for="TextDecoderCommon" data-dfn-type="dfn" data-noexport id="textdecodercommon-i-o-queue">I/O queue<span id="textdecoder-stream"></span><span id="textdecoderstream-stream"></span><span id="textdecodercommon-stream"></span></dfn> <dd>An <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream②⓪">I/O queue</a> of bytes. <dt><dfn class="dfn-paneled" data-dfn-for="TextDecoderCommon" data-dfn-type="dfn" data-noexport id="textdecoder-ignore-bom-flag">ignore BOM</dfn> <dd>A boolean, initially false. <dt><dfn class="dfn-paneled" data-dfn-for="TextDecoderCommon" data-dfn-type="dfn" data-noexport id="textdecoder-bom-seen-flag">BOM seen</dfn> <dd>A boolean, initially false. <dt><dfn class="dfn-paneled" data-dfn-for="TextDecoderCommon" data-dfn-type="dfn" data-noexport id="textdecoder-error-mode">error mode</dfn> <dd>An <a data-link-type="dfn" href="#error-mode" id="ref-for-error-mode⑤">error mode</a>, initially "<code>replacement</code>". </dl> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="concept-td-serialize">serialize I/O queue</dfn> algorithm, given a <code class="idl"><a data-link-type="idl" href="#textdecodercommon" id="ref-for-textdecodercommon②">TextDecoderCommon</a></code> <var>decoder</var> and an <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream②①">I/O queue</a> of scalar values <var>ioQueue</var>, runs these steps: </p> <ol> <li> <p>Let <var>output</var> be the empty string. </p> <li> <p>While true: </p> <ol> <li> <p>Let <var>item</var> be the result of <a data-link-type="dfn" href="#concept-stream-read" id="ref-for-concept-stream-read⑧">reading</a> from <var>ioQueue</var>. </p> <li> <p>If <var>item</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream①⑨">end-of-queue</a>, then return <var>output</var>. </p> <li> <p>If <var>decoder</var>’s <a data-link-type="dfn" href="#textdecoder-encoding" id="ref-for-textdecoder-encoding">encoding</a> is <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8①⑤">UTF-8</a> or <a data-link-type="dfn" href="#utf-16be-le" id="ref-for-utf-16be-le④">UTF-16BE/LE</a>, and <var>decoder</var>’s <a data-link-type="dfn" href="#textdecoder-ignore-bom-flag" id="ref-for-textdecoder-ignore-bom-flag">ignore BOM</a> and <a data-link-type="dfn" href="#textdecoder-bom-seen-flag" id="ref-for-textdecoder-bom-seen-flag">BOM seen</a> are false, then: </p> <ol> <li> <p>Set <var>decoder</var>’s <a data-link-type="dfn" href="#textdecoder-bom-seen-flag" id="ref-for-textdecoder-bom-seen-flag①">BOM seen</a> to true. </p> <li> <p>If <var>item</var> is U+FEFF, then <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#iteration-continue" id="ref-for-iteration-continue">continue</a>. </p> </ol> <li> <p>Append <var>item</var> to <var>output</var>. </p> </ol> </ol> <p class="note" role="note">This algorithm is intentionally different with respect to BOM handling from the <a data-link-type="dfn" href="#decode" id="ref-for-decode④">decode</a> algorithm used by the rest of the platform to give API users more control. </p> <hr> <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="TextDecoderCommon" data-dfn-type="attribute" data-export id="dom-textdecoder-encoding"><code>encoding</code></dfn> getter steps are to return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this">this</a>’s <a data-link-type="dfn" href="#textdecoder-encoding" id="ref-for-textdecoder-encoding①">encoding</a>’s <a data-link-type="dfn" href="#name" id="ref-for-name②">name</a>, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-lowercase" id="ref-for-ascii-lowercase①">ASCII lowercased</a>. </p> <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="TextDecoderCommon" data-dfn-type="attribute" data-export id="dom-textdecoder-fatal"><code>fatal</code></dfn> getter steps are to return true if <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①">this</a>’s <a data-link-type="dfn" href="#textdecoder-error-mode" id="ref-for-textdecoder-error-mode">error mode</a> is "<code>fatal</code>", otherwise false. </p> <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="TextDecoderCommon" data-dfn-type="attribute" data-export id="dom-textdecoder-ignorebom"><code>ignoreBOM</code></dfn> getter steps are to return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②">this</a>’s <a data-link-type="dfn" href="#textdecoder-ignore-bom-flag" id="ref-for-textdecoder-ignore-bom-flag①">ignore BOM</a>. </p> <h3 class="heading settled" data-level="7.2" id="interface-textdecoder"><span class="secno">7.2. </span><span class="content">Interface <code class="idl"><a data-link-type="idl" href="#textdecoder" id="ref-for-textdecoder①">TextDecoder</a></code></span><a class="self-link" href="#interface-textdecoder"></a></h3> <pre class="idl highlight def"><c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="textdecoderoptions"><code><c- g>TextDecoderOptions</c-></code></dfn> { <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean" id="ref-for-idl-boolean②"><c- b>boolean</c-></a> <dfn class="dfn-paneled idl-code" data-default="false" data-dfn-for="TextDecoderOptions" data-dfn-type="dict-member" data-export data-type="boolean" id="dom-textdecoderoptions-fatal"><code><c- g>fatal</c-></code></dfn> = <c- b>false</c->; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean" id="ref-for-idl-boolean③"><c- b>boolean</c-></a> <dfn class="dfn-paneled idl-code" data-default="false" data-dfn-for="TextDecoderOptions" data-dfn-type="dict-member" data-export data-type="boolean" id="dom-textdecoderoptions-ignorebom"><code><c- g>ignoreBOM</c-></code></dfn> = <c- b>false</c->; }; <c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="textdecodeoptions"><code><c- g>TextDecodeOptions</c-></code></dfn> { <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean" id="ref-for-idl-boolean④"><c- b>boolean</c-></a> <dfn class="dfn-paneled idl-code" data-default="false" data-dfn-for="TextDecodeOptions" data-dfn-type="dict-member" data-export data-type="boolean" id="dom-textdecodeoptions-stream"><code><c- g>stream</c-></code></dfn> = <c- b>false</c->; }; [Exposed=*] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="textdecoder"><code><c- g>TextDecoder</c-></code></dfn> { <a class="idl-code" data-link-type="constructor" href="#dom-textdecoder" id="ref-for-dom-textdecoder"><c- g>constructor</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString①"><c- b>DOMString</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TextDecoder/TextDecoder(label, options), TextDecoder/constructor(label, options), TextDecoder/TextDecoder(label), TextDecoder/constructor(label), TextDecoder/TextDecoder(), TextDecoder/constructor()" data-dfn-type="argument" data-export id="dom-textdecoder-textdecoder-label-options-label"><code><c- g>label</c-></code></dfn> = "utf-8", <c- b>optional</c-> <a data-link-type="idl-name" href="#textdecoderoptions" id="ref-for-textdecoderoptions"><c- n>TextDecoderOptions</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TextDecoder/TextDecoder(label, options), TextDecoder/constructor(label, options), TextDecoder/TextDecoder(label), TextDecoder/constructor(label), TextDecoder/TextDecoder(), TextDecoder/constructor()" data-dfn-type="argument" data-export id="dom-textdecoder-textdecoder-label-options-options"><code><c- g>options</c-></code></dfn> = {}); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-USVString" id="ref-for-idl-USVString"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="method" href="#dom-textdecoder-decode" id="ref-for-dom-textdecoder-decode"><c- g>decode</c-></a>(<c- b>optional</c-> <a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#AllowSharedBufferSource" id="ref-for-AllowSharedBufferSource"><c- n>AllowSharedBufferSource</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TextDecoder/decode(input, options), TextDecoder/decode(input), TextDecoder/decode()" data-dfn-type="argument" data-export id="dom-textdecoder-decode-input-options-input"><code><c- g>input</c-></code></dfn>, <c- b>optional</c-> <a data-link-type="idl-name" href="#textdecodeoptions" id="ref-for-textdecodeoptions"><c- n>TextDecodeOptions</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TextDecoder/decode(input, options), TextDecoder/decode(input), TextDecoder/decode()" data-dfn-type="argument" data-export id="dom-textdecoder-decode-input-options-options"><code><c- g>options</c-></code></dfn> = {}); }; <a data-link-type="idl-name" href="#textdecoder" id="ref-for-textdecoder②"><c- n>TextDecoder</c-></a> <c- b>includes</c-> <a data-link-type="idl-name" href="#textdecodercommon" id="ref-for-textdecodercommon③"><c- n>TextDecoderCommon</c-></a>; </pre> <p>A <code class="idl"><a data-link-type="idl" href="#textdecoder" id="ref-for-textdecoder③">TextDecoder</a></code> object has an associated <dfn class="dfn-paneled" data-dfn-for="TextDecoder" data-dfn-type="dfn" data-noexport id="textdecoder-do-not-flush-flag">do not flush</dfn>, which is a boolean, initially false. </p> <dl class="domintro"> <dt><code><var>decoder</var> = new <a class="idl-code" data-link-type="constructor" href="#dom-textdecoder" id="ref-for-dom-textdecoder①">TextDecoder([<var>label</var> = "utf-8" [, <var>options</var>]])</a></code> <dd> <p>Returns a new <code class="idl"><a data-link-type="idl" href="#textdecoder" id="ref-for-textdecoder④">TextDecoder</a></code> object. </p> <p>If <var>label</var> is either not a label or is a <a data-link-type="dfn" href="#label" id="ref-for-label⑥">label</a> for <a data-link-type="dfn" href="#replacement" id="ref-for-replacement⑤">replacement</a>, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-throw" id="ref-for-dfn-throw">throws</a> a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-rangeerror" id="ref-for-exceptiondef-rangeerror">RangeError</a></code>. </p> <dt><code><var>decoder</var> . <a class="idl-code" data-link-type="attribute" href="#dom-textdecoder-encoding" id="ref-for-dom-textdecoder-encoding①">encoding</a></code> <dd> <p>Returns <a data-link-type="dfn" href="#textdecoder-encoding" id="ref-for-textdecoder-encoding②">encoding</a>’s <a data-link-type="dfn" href="#name" id="ref-for-name③">name</a>, lowercased. </p> <dt><code><var>decoder</var> . <a class="idl-code" data-link-type="attribute" href="#dom-textdecoder-fatal" id="ref-for-dom-textdecoder-fatal①">fatal</a></code> <dd> <p>Returns true if <a data-link-type="dfn" href="#textdecoder-error-mode" id="ref-for-textdecoder-error-mode①">error mode</a> is "<code>fatal</code>", otherwise false. </p> <dt><code><var>decoder</var> . <a class="idl-code" data-link-type="attribute" href="#dom-textdecoder-ignorebom" id="ref-for-dom-textdecoder-ignorebom①">ignoreBOM</a></code> <dd> <p>Returns the value of <a data-link-type="dfn" href="#textdecoder-ignore-bom-flag" id="ref-for-textdecoder-ignore-bom-flag②">ignore BOM</a>. </p> <dt><code><var>decoder</var> . <a class="idl-code" data-link-type="method" href="#dom-textdecoder-decode" id="ref-for-dom-textdecoder-decode①">decode([<var>input</var> [, <var>options</var>]])</a></code> <dd> <p>Returns the result of running <a data-link-type="dfn" href="#textdecoder-encoding" id="ref-for-textdecoder-encoding③">encoding</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder①②">decoder</a>. The method can be invoked zero or more times with <var>options</var>’s <code>stream</code> set to true, and then once without <var>options</var>’s <code>stream</code> (or set to false), to process a fragmented input. If the invocation without <var>options</var>’s <code>stream</code> (or set to false) has no <var>input</var>, it’s clearest to omit both arguments. </p> <pre class="example" id="example-end-of-stream"><a class="self-link" href="#example-end-of-stream"></a><code class="lang-javascript highlight"><c- a>var</c-> string <c- o>=</c-> <c- u>""</c-><c- p>,</c-> decoder <c- o>=</c-> <c- ow>new</c-> TextDecoder<c- p>(</c->encoding<c- p>),</c-> buffer<c- p>;</c-> <c- k>while</c-><c- p>(</c->buffer <c- o>=</c-> next_chunk<c- p>())</c-> <c- p>{</c-> string <c- o>+=</c-> decoder<c- p>.</c->decode<c- p>(</c->buffer<c- p>,</c-> <c- p>{</c->stream<c- o>:</c-><c- kc>true</c-><c- p>});</c-> <c- p>}</c-> string <c- o>+=</c-> decoder<c- p>.</c->decode<c- p>();</c-> <c- c1>// end-of-queue</c-></code></pre> <p>If the <a data-link-type="dfn" href="#textdecoder-error-mode" id="ref-for-textdecoder-error-mode②">error mode</a> is "<code>fatal</code>" and <a data-link-type="dfn" href="#textdecoder-encoding" id="ref-for-textdecoder-encoding④">encoding</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder①③">decoder</a> returns <a data-link-type="dfn" href="#error" id="ref-for-error⑧">error</a>, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-throw" id="ref-for-dfn-throw①">throws</a> a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror">TypeError</a></code>. </p> </dl> <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="TextDecoder" data-dfn-type="constructor" data-export data-lt="TextDecoder(label, options)|constructor(label, options)|TextDecoder(label)|constructor(label)|TextDecoder()|constructor()" id="dom-textdecoder"><code>new TextDecoder(<var>label</var>, <var>options</var>)</code></dfn> constructor steps are: </p> <ol> <li> <p>Let <var>encoding</var> be the result of <a data-link-type="dfn" href="#concept-encoding-get" id="ref-for-concept-encoding-get①">getting an encoding</a> from <var>label</var>. </p> <li> <p>If <var>encoding</var> is failure or <a data-link-type="dfn" href="#replacement" id="ref-for-replacement⑥">replacement</a>, then <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-throw" id="ref-for-dfn-throw②">throw</a> a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-rangeerror" id="ref-for-exceptiondef-rangeerror①">RangeError</a></code>. </p> <li> <p>Set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this③">this</a>’s <a data-link-type="dfn" href="#textdecoder-encoding" id="ref-for-textdecoder-encoding⑤">encoding</a> to <var>encoding</var>. </p> <li> <p>If <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-textdecoderoptions-fatal" id="ref-for-dom-textdecoderoptions-fatal">fatal</a></code>"] is true, then set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this④">this</a>’s <a data-link-type="dfn" href="#textdecoder-error-mode" id="ref-for-textdecoder-error-mode③">error mode</a> to "<code>fatal</code>". </p> <li> <p>Set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑤">this</a>’s <a data-link-type="dfn" href="#textdecoder-ignore-bom-flag" id="ref-for-textdecoder-ignore-bom-flag③">ignore BOM</a> to <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-textdecoderoptions-ignorebom" id="ref-for-dom-textdecoderoptions-ignorebom">ignoreBOM</a></code>"]. </p> </ol> <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="TextDecoder" data-dfn-type="method" data-export data-lt="decode(input, options)|decode(input)|decode()" id="dom-textdecoder-decode"><code>decode(<var>input</var>, <var>options</var>)</code></dfn> method steps are: </p> <ol> <li> <p>If <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑥">this</a>’s <a data-link-type="dfn" href="#textdecoder-do-not-flush-flag" id="ref-for-textdecoder-do-not-flush-flag">do not flush</a> is false, then set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑦">this</a>’s <a data-link-type="dfn" href="#textdecodercommon-decoder" id="ref-for-textdecodercommon-decoder">decoder</a> to a new instance of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑧">this</a>’s <a data-link-type="dfn" href="#textdecoder-encoding" id="ref-for-textdecoder-encoding⑥">encoding</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder①④">decoder</a>, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this⑨">this</a>’s <a data-link-type="dfn" href="#textdecodercommon-i-o-queue" id="ref-for-textdecodercommon-i-o-queue">I/O queue</a> to the <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream②②">I/O queue</a> of bytes « <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream②⓪">end-of-queue</a> », and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⓪">this</a>’s <a data-link-type="dfn" href="#textdecoder-bom-seen-flag" id="ref-for-textdecoder-bom-seen-flag②">BOM seen</a> to false. </p> <li> <p>Set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①①">this</a>’s <a data-link-type="dfn" href="#textdecoder-do-not-flush-flag" id="ref-for-textdecoder-do-not-flush-flag①">do not flush</a> to <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-textdecodeoptions-stream" id="ref-for-dom-textdecodeoptions-stream">stream</a></code>"]. </p> <li> <p>If <var>input</var> is given, then <a data-link-type="dfn" href="#concept-stream-push" id="ref-for-concept-stream-push⑧">push</a> a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-get-buffer-source-copy" id="ref-for-dfn-get-buffer-source-copy">copy of</a> <var>input</var> to <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①②">this</a>’s <a data-link-type="dfn" href="#textdecodercommon-i-o-queue" id="ref-for-textdecodercommon-i-o-queue①">I/O queue</a>. </p> <p class="note" role="note">Implementations are strongly encouraged to use an implementation strategy that avoids this copy. When doing so they will have to make sure that changes to <var>input</var> do not affect future calls to <a class="idl-code" data-link-type="method" href="#dom-textdecoder-decode" id="ref-for-dom-textdecoder-decode②"><code>decode()</code></a>. </p> <p class="warning" id="sharedarraybuffer-warning">The memory exposed by <code>SharedArrayBuffer</code> objects does not adhere to data race freedom properties required by the memory model of programming languages typically used for implementations. When implementing, take care to use the appropriate facilities when accessing memory exposed by <code>SharedArrayBuffer</code> objects. </p> <li> <p>Let <var>output</var> be the <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream②③">I/O queue</a> of scalar values « <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream②①">end-of-queue</a> ». </p> <li> <p>While true: </p> <ol> <li> <p>Let <var>item</var> be the result of <a data-link-type="dfn" href="#concept-stream-read" id="ref-for-concept-stream-read⑨">reading</a> from <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①③">this</a>’s <a data-link-type="dfn" href="#textdecodercommon-i-o-queue" id="ref-for-textdecodercommon-i-o-queue②">I/O queue</a>. </p> <li> <p>If <var>item</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream②②">end-of-queue</a> and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①④">this</a>’s <a data-link-type="dfn" href="#textdecoder-do-not-flush-flag" id="ref-for-textdecoder-do-not-flush-flag②">do not flush</a> is true, then return the result of running <a data-link-type="dfn" href="#concept-td-serialize" id="ref-for-concept-td-serialize">serialize I/O queue</a> with <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⑤">this</a> and <var>output</var>. </p> <p class="note" role="note">The way streaming works is to not handle <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream②③">end-of-queue</a> here when <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⑥">this</a>’s <a data-link-type="dfn" href="#textdecoder-do-not-flush-flag" id="ref-for-textdecoder-do-not-flush-flag③">do not flush</a> is true and to not set it to false. That way in a subsequent invocation <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⑦">this</a>’s <a data-link-type="dfn" href="#textdecodercommon-decoder" id="ref-for-textdecodercommon-decoder①">decoder</a> is not set anew in the first step of the algorithm and its state is preserved. </p> <li> <p>Otherwise: </p> <ol> <li> <p>Let <var>result</var> be the result of <a data-link-type="dfn" href="#concept-encoding-process" id="ref-for-concept-encoding-process①">processing an item</a> with <var>item</var>, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⑧">this</a>’s <a data-link-type="dfn" href="#textdecodercommon-decoder" id="ref-for-textdecodercommon-decoder②">decoder</a>, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this①⑨">this</a>’s <a data-link-type="dfn" href="#textdecodercommon-i-o-queue" id="ref-for-textdecodercommon-i-o-queue③">I/O queue</a>, <var>output</var>, and <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②⓪">this</a>’s <a data-link-type="dfn" href="#textdecoder-error-mode" id="ref-for-textdecoder-error-mode④">error mode</a>. </p> <li> <p>If <var>result</var> is <a data-link-type="dfn" href="#finished" id="ref-for-finished①">finished</a>, then return the result of running <a data-link-type="dfn" href="#concept-td-serialize" id="ref-for-concept-td-serialize①">serialize I/O queue</a> with <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②①">this</a> and <var>output</var>. </p> <li> <p>Otherwise, if <var>result</var> is <a data-link-type="dfn" href="#error" id="ref-for-error⑨">error</a>, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-throw" id="ref-for-dfn-throw③">throw</a> a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror①">TypeError</a></code>. </p> </ol> </ol> </ol> <h3 class="heading settled" data-level="7.3" id="interface-mixin-textencodercommon"><span class="secno">7.3. </span><span class="content">Interface mixin <code class="idl"><a data-link-type="idl" href="#textencodercommon" id="ref-for-textencodercommon">TextEncoderCommon</a></code></span><a class="self-link" href="#interface-mixin-textencodercommon"></a></h3> <pre class="idl highlight def"><c- b>interface</c-> <c- b>mixin</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="textencodercommon"><code><c- g>TextEncoderCommon</c-></code></dfn> { <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString②"><c- b>DOMString</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="DOMString" href="#dom-textencoder-encoding" id="ref-for-dom-textencoder-encoding"><c- g>encoding</c-></a>; }; </pre> <p>The <code class="idl"><a data-link-type="idl" href="#textencodercommon" id="ref-for-textencodercommon①">TextEncoderCommon</a></code> interface mixin defines common getters that are shared between <code class="idl"><a data-link-type="idl" href="#textencoder" id="ref-for-textencoder①">TextEncoder</a></code> and <code class="idl"><a data-link-type="idl" href="#textencoderstream" id="ref-for-textencoderstream">TextEncoderStream</a></code> objects. </p> <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="TextEncoderCommon" data-dfn-type="attribute" data-export id="dom-textencoder-encoding"><code>encoding</code></dfn> getter steps are to return "<code>utf-8</code>". </p> <h3 class="heading settled" data-level="7.4" id="interface-textencoder"><span class="secno">7.4. </span><span class="content">Interface <code class="idl"><a data-link-type="idl" href="#textencoder" id="ref-for-textencoder②">TextEncoder</a></code></span><a class="self-link" href="#interface-textencoder"></a></h3> <pre class="idl highlight def"><c- b>dictionary</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="dictionary" data-export id="dictdef-textencoderencodeintoresult"><code><c- g>TextEncoderEncodeIntoResult</c-></code></dfn> { <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-long-long" id="ref-for-idl-unsigned-long-long"><c- b>unsigned</c-> <c- b>long</c-> <c- b>long</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TextEncoderEncodeIntoResult" data-dfn-type="dict-member" data-export data-type="unsigned long long" id="dom-textencoderencodeintoresult-read"><code><c- g>read</c-></code></dfn>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-long-long" id="ref-for-idl-unsigned-long-long①"><c- b>unsigned</c-> <c- b>long</c-> <c- b>long</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TextEncoderEncodeIntoResult" data-dfn-type="dict-member" data-export data-type="unsigned long long" id="dom-textencoderencodeintoresult-written"><code><c- g>written</c-></code></dfn>; }; [Exposed=*] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="textencoder"><code><c- g>TextEncoder</c-></code></dfn> { <a class="idl-code" data-link-type="constructor" href="#dom-textencoder" id="ref-for-dom-textencoder"><c- g>constructor</c-></a>(); [<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#NewObject" id="ref-for-NewObject"><c- g>NewObject</c-></a>] <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-Uint8Array" id="ref-for-idl-Uint8Array①"><c- b>Uint8Array</c-></a> <a class="idl-code" data-link-type="method" href="#dom-textencoder-encode" id="ref-for-dom-textencoder-encode"><c- g>encode</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-USVString" id="ref-for-idl-USVString①"><c- b>USVString</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TextEncoder/encode(input), TextEncoder/encode()" data-dfn-type="argument" data-export id="dom-textencoder-encode-input-input"><code><c- g>input</c-></code></dfn> = ""); <a data-link-type="idl-name" href="#dictdef-textencoderencodeintoresult" id="ref-for-dictdef-textencoderencodeintoresult"><c- n>TextEncoderEncodeIntoResult</c-></a> <a class="idl-code" data-link-type="method" href="#dom-textencoder-encodeinto" id="ref-for-dom-textencoder-encodeinto"><c- g>encodeInto</c-></a>(<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-USVString" id="ref-for-idl-USVString②"><c- b>USVString</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TextEncoder/encodeInto(source, destination)" data-dfn-type="argument" data-export id="dom-textencoder-encodeinto-source-destination-source"><code><c- g>source</c-></code></dfn>, [<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#AllowShared" id="ref-for-AllowShared"><c- g>AllowShared</c-></a>] <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-Uint8Array" id="ref-for-idl-Uint8Array②"><c- b>Uint8Array</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TextEncoder/encodeInto(source, destination)" data-dfn-type="argument" data-export id="dom-textencoder-encodeinto-source-destination-destination"><code><c- g>destination</c-></code></dfn>); }; <a data-link-type="idl-name" href="#textencoder" id="ref-for-textencoder③"><c- n>TextEncoder</c-></a> <c- b>includes</c-> <a data-link-type="idl-name" href="#textencodercommon" id="ref-for-textencodercommon②"><c- n>TextEncoderCommon</c-></a>; </pre> <p class="note no-backref" role="note">A <code class="idl"><a data-link-type="idl" href="#textencoder" id="ref-for-textencoder④">TextEncoder</a></code> object offers no <var>label</var> argument as it only supports <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8①⑥">UTF-8</a>. It also offers no <code>stream</code> option as no <a data-link-type="dfn" href="#encoder" id="ref-for-encoder①③">encoder</a> requires buffering of scalar values. </p> <hr> <dl class="domintro"> <dt><code><var>encoder</var> = new <a class="idl-code" data-link-type="constructor" href="#dom-textencoder" id="ref-for-dom-textencoder①">TextEncoder()</a></code> <dd> <p>Returns a new <code class="idl"><a data-link-type="idl" href="#textencoder" id="ref-for-textencoder⑤">TextEncoder</a></code> object. </p> <dt><code><var>encoder</var> . <a class="idl-code" data-link-type="attribute" href="#dom-textencoder-encoding" id="ref-for-dom-textencoder-encoding①">encoding</a></code> <dd> <p>Returns "<code>utf-8</code>". </p> <dt><code><var>encoder</var> . <a class="idl-code" data-link-type="method" href="#dom-textencoder-encode" id="ref-for-dom-textencoder-encode①">encode([<var>input</var> = ""])</a></code> <dd> <p>Returns the result of running <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8①⑦">UTF-8</a>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder①④">encoder</a>. </p> <dt><code><var>encoder</var> . <a class="idl-code" data-link-type="method" href="#dom-textencoder-encodeinto" id="ref-for-dom-textencoder-encodeinto①">encodeInto(<var>source</var>, <var>destination</var>)</a></code> <dd> <p>Runs the <a data-link-type="dfn" href="#utf-8-encoder" id="ref-for-utf-8-encoder">UTF-8 encoder</a> on <var>source</var>, stores the result of that operation into <var>destination</var>, and returns the progress made as an object wherein <code class="idl"><a data-link-type="idl" href="#dom-textencoderencodeintoresult-read" id="ref-for-dom-textencoderencodeintoresult-read">read</a></code> is the number of converted <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-unit" id="ref-for-code-unit">code units</a> of <var>source</var> and <code class="idl"><a data-link-type="idl" href="#dom-textencoderencodeintoresult-written" id="ref-for-dom-textencoderencodeintoresult-written">written</a></code> is the number of bytes modified in <var>destination</var>. </p> </dl> <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="TextEncoder" data-dfn-type="constructor" data-export data-lt="TextEncoder()|constructor()" id="dom-textencoder"><code>new TextEncoder()</code></dfn> constructor steps are to do nothing. </p> <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="TextEncoder" data-dfn-type="method" data-export data-lt="encode(input)|encode()" id="dom-textencoder-encode"><code>encode(<var>input</var>)</code></dfn> method steps are: </p> <ol> <li> <p><a data-link-type="dfn" href="#to-i-o-queue-convert" id="ref-for-to-i-o-queue-convert">Convert</a> <var>input</var> to an <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream②④">I/O queue</a> of scalar values. </p> <li> <p>Let <var>output</var> be the <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream②⑤">I/O queue</a> of bytes « <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream②④">end-of-queue</a> ». </p> <li> <p>While true: </p> <ol> <li> <p>Let <var>item</var> be the result of <a data-link-type="dfn" href="#concept-stream-read" id="ref-for-concept-stream-read①⓪">reading</a> from <var>input</var>. </p> <li> <p>Let <var>result</var> be the result of <a data-link-type="dfn" href="#concept-encoding-process" id="ref-for-concept-encoding-process②">processing an item</a> with <var>item</var>, an instance of the <a data-link-type="dfn" href="#utf-8-encoder" id="ref-for-utf-8-encoder①">UTF-8 encoder</a>, <var>input</var>, <var>output</var>, and "<code>fatal</code>". </p> <li> <p>Assert: <var>result</var> is not an <a data-link-type="dfn" href="#error" id="ref-for-error①⓪">error</a>. </p> <p class="note" role="note">The <a data-link-type="dfn" href="#utf-8-encoder" id="ref-for-utf-8-encoder②">UTF-8 encoder</a> cannot return <a data-link-type="dfn" href="#error" id="ref-for-error①①">error</a>. </p> <li> <p>If <var>result</var> is <a data-link-type="dfn" href="#finished" id="ref-for-finished②">finished</a>, then <a data-link-type="dfn" href="#from-i-o-queue-convert" id="ref-for-from-i-o-queue-convert">convert</a> <var>output</var> into a byte sequence and return a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-Uint8Array" id="ref-for-idl-Uint8Array③">Uint8Array</a></code> object wrapping an <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer" id="ref-for-idl-ArrayBuffer②">ArrayBuffer</a></code> containing <var>output</var>. </p> </ol> </ol> <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="TextEncoder" data-dfn-type="method" data-export id="dom-textencoder-encodeinto"><code>encodeInto(<var>source</var>, <var>destination</var>)</code></dfn> method steps are: </p> <ol> <li> <p>Let <var>read</var> be 0. </p> <li> <p>Let <var>written</var> be 0. </p> <li> <p>Let <var>encoder</var> be an instance of the <a data-link-type="dfn" href="#utf-8-encoder" id="ref-for-utf-8-encoder③">UTF-8 encoder</a>. </p> <li> <p>Let <var>unused</var> be the <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream②⑥">I/O queue</a> of scalar values « <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream②⑤">end-of-queue</a> ». </p> <p class="note" role="note">The <a data-link-type="dfn" href="#handler" id="ref-for-handler②">handler</a> algorithm invoked below requires this argument, but it is not used by the <a data-link-type="dfn" href="#utf-8-encoder" id="ref-for-utf-8-encoder④">UTF-8 encoder</a>. </p> <li> <p><a data-link-type="dfn" href="#to-i-o-queue-convert" id="ref-for-to-i-o-queue-convert①">Convert</a> <var>source</var> to an <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream②⑦">I/O queue</a> of scalar values. </p> <li> <p>While true: </p> <ol> <li> <p>Let <var>item</var> be the result of <a data-link-type="dfn" href="#concept-stream-read" id="ref-for-concept-stream-read①①">reading</a> from <var>source</var>. </p> <li> <p>Let <var>result</var> be the result of running <var>encoder</var>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler③">handler</a> on <var>unused</var> and <var>item</var>. </p> <li> <p>If <var>result</var> is <a data-link-type="dfn" href="#finished" id="ref-for-finished③">finished</a>, then <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#iteration-break" id="ref-for-iteration-break①">break</a>. </p> <li> <p>Otherwise: </p> <ol> <li> <p>If <var>destination</var>’s <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#buffersource-byte-length" id="ref-for-buffersource-byte-length">byte length</a> − <var>written</var> is greater than or equal to the number of bytes in <var>result</var>, then: </p> <ol> <li> <p>If <var>item</var> is greater than U+FFFF, then increment <var>read</var> by 2. </p> <li> <p>Otherwise, increment <var>read</var> by 1. </p> <li> <p><a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#arraybufferview-write" id="ref-for-arraybufferview-write">Write</a> the bytes in <var>result</var> into <var>destination</var>, with <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#arraybufferview-write-startingoffset" id="ref-for-arraybufferview-write-startingoffset"><i>startingOffset</i></a> set to <var>written</var>. </p> <p class="warning">See the <a href="#sharedarraybuffer-warning">warning for <code>SharedArrayBuffer</code> objects</a> above. </p> <li> <p>Increment <var>written</var> by the number of bytes in <var>result</var>. </p> </ol> <li> <p>Otherwise, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#iteration-break" id="ref-for-iteration-break②">break</a>. </p> </ol> </ol> <li> <p>Return «[ "<code class="idl"><a data-link-type="idl" href="#dom-textencoderencodeintoresult-read" id="ref-for-dom-textencoderencodeintoresult-read①">read</a></code>" → <var>read</var>, "<code class="idl"><a data-link-type="idl" href="#dom-textencoderencodeintoresult-written" id="ref-for-dom-textencoderencodeintoresult-written①">written</a></code>" → <var>written</var> ]». </p> </ol> <div class="example" id="example-textencoder-encodeinto"> <a class="self-link" href="#example-textencoder-encodeinto"></a> <p>The <a class="idl-code" data-link-type="method" href="#dom-textencoder-encodeinto" id="ref-for-dom-textencoder-encodeinto②">encodeInto()</a> method can be used to encode a string into an existing <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer" id="ref-for-idl-ArrayBuffer③">ArrayBuffer</a></code> object. Various details below are left as an exercise for the reader, but this demonstrates an approach one could take to use this method: </p> <pre><code class="lang-javascript highlight"><c- a>function</c-> convertString<c- p>(</c->buffer<c- p>,</c-> input<c- p>,</c-> callback<c- p>)</c-> <c- p>{</c-> <c- a>let</c-> bufferSize <c- o>=</c-> <c- mf>256</c-><c- p>,</c-> bufferStart <c- o>=</c-> malloc<c- p>(</c->buffer<c- p>,</c-> bufferSize<c- p>),</c-> writeOffset <c- o>=</c-> <c- mf>0</c-><c- p>,</c-> readOffset <c- o>=</c-> <c- mf>0</c-><c- p>;</c-> <c- k>while</c-> <c- p>(</c-><c- kc>true</c-><c- p>)</c-> <c- p>{</c-> <c- a>const</c-> view <c- o>=</c-> <c- ow>new</c-> Uint8Array<c- p>(</c->buffer<c- p>,</c-> bufferStart <c- o>+</c-> writeOffset<c- p>,</c-> bufferSize <c- o>-</c-> writeOffset<c- p>),</c-> <c- p>{</c->read<c- p>,</c-> written<c- p>}</c-> <c- o>=</c-> cachedEncoder<c- p>.</c->encodeInto<c- p>(</c->input<c- p>.</c->substring<c- p>(</c->readOffset<c- p>),</c-> view<c- p>);</c-> readOffset <c- o>+=</c-> read<c- p>;</c-> writeOffset <c- o>+=</c-> written<c- p>;</c-> <c- k>if</c-> <c- p>(</c->readOffset <c- o>===</c-> input<c- p>.</c->length<c- p>)</c-> <c- p>{</c-> callback<c- p>(</c->bufferStart<c- p>,</c-> writeOffset<c- p>);</c-> free<c- p>(</c->buffer<c- p>,</c-> bufferStart<c- p>);</c-> <c- k>return</c-><c- p>;</c-> <c- p>}</c-> bufferSize <c- o>*=</c-> <c- mf>2</c-><c- p>;</c-> bufferStart <c- o>=</c-> realloc<c- p>(</c->buffer<c- p>,</c-> bufferStart<c- p>,</c-> bufferSize<c- p>);</c-> <c- p>}</c-> <c- p>}</c-> </code></pre> </div> <h3 class="heading settled" data-level="7.5" id="interface-textdecoderstream"><span class="secno">7.5. </span><span class="content">Interface <code class="idl"><a data-link-type="idl" href="#textdecoderstream" id="ref-for-textdecoderstream①">TextDecoderStream</a></code></span><a class="self-link" href="#interface-textdecoderstream"></a></h3> <pre class="idl highlight def">[Exposed=*] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="textdecoderstream"><code><c- g>TextDecoderStream</c-></code></dfn> { <a class="idl-code" data-link-type="constructor" href="#dom-textdecoderstream" id="ref-for-dom-textdecoderstream"><c- g>constructor</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString③"><c- b>DOMString</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TextDecoderStream/TextDecoderStream(label, options), TextDecoderStream/constructor(label, options), TextDecoderStream/TextDecoderStream(label), TextDecoderStream/constructor(label), TextDecoderStream/TextDecoderStream(), TextDecoderStream/constructor()" data-dfn-type="argument" data-export id="dom-textdecoderstream-textdecoderstream-label-options-label"><code><c- g>label</c-></code></dfn> = "utf-8", <c- b>optional</c-> <a data-link-type="idl-name" href="#textdecoderoptions" id="ref-for-textdecoderoptions①"><c- n>TextDecoderOptions</c-></a> <dfn class="dfn-paneled idl-code" data-dfn-for="TextDecoderStream/TextDecoderStream(label, options), TextDecoderStream/constructor(label, options), TextDecoderStream/TextDecoderStream(label), TextDecoderStream/constructor(label), TextDecoderStream/TextDecoderStream(), TextDecoderStream/constructor()" data-dfn-type="argument" data-export id="dom-textdecoderstream-textdecoderstream-label-options-options"><code><c- g>options</c-></code></dfn> = {}); }; <a data-link-type="idl-name" href="#textdecoderstream" id="ref-for-textdecoderstream②"><c- n>TextDecoderStream</c-></a> <c- b>includes</c-> <a data-link-type="idl-name" href="#textdecodercommon" id="ref-for-textdecodercommon④"><c- n>TextDecoderCommon</c-></a>; <a data-link-type="idl-name" href="#textdecoderstream" id="ref-for-textdecoderstream③"><c- n>TextDecoderStream</c-></a> <c- b>includes</c-> <a data-link-type="idl-name" href="https://streams.spec.whatwg.org/#generictransformstream" id="ref-for-generictransformstream"><c- n>GenericTransformStream</c-></a>; </pre> <dl class="domintro"> <dt><code><var>decoder</var> = new <a class="idl-code" data-link-type="constructor" href="#dom-textdecoderstream" id="ref-for-dom-textdecoderstream①">TextDecoderStream([<var>label</var> = "utf-8" [, <var>options</var>]])</a></code> <dd> <p>Returns a new <code class="idl"><a data-link-type="idl" href="#textdecoderstream" id="ref-for-textdecoderstream④">TextDecoderStream</a></code> object. </p> <p>If <var>label</var> is either not a label or is a <a data-link-type="dfn" href="#label" id="ref-for-label⑦">label</a> for <a data-link-type="dfn" href="#replacement" id="ref-for-replacement⑦">replacement</a>, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-throw" id="ref-for-dfn-throw④">throws</a> a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-rangeerror" id="ref-for-exceptiondef-rangeerror②">RangeError</a></code>. </p> <dt><code><var>decoder</var> . <a class="idl-code" data-link-type="attribute" href="#dom-textdecoder-encoding" id="ref-for-dom-textdecoder-encoding②">encoding</a></code> <dd> <p>Returns <a data-link-type="dfn" href="#textdecoder-encoding" id="ref-for-textdecoder-encoding⑦">encoding</a>’s <a data-link-type="dfn" href="#name" id="ref-for-name④">name</a>, lowercased. </p> <dt><code><var>decoder</var> . <a class="idl-code" data-link-type="attribute" href="#dom-textdecoder-fatal" id="ref-for-dom-textdecoder-fatal②">fatal</a></code> <dd> <p>Returns true if <a data-link-type="dfn" href="#textdecoder-error-mode" id="ref-for-textdecoder-error-mode⑤">error mode</a> is "<code>fatal</code>", and false otherwise. </p> <dt><code><var>decoder</var> . <a class="idl-code" data-link-type="attribute" href="#dom-textdecoder-ignorebom" id="ref-for-dom-textdecoder-ignorebom②">ignoreBOM</a></code> <dd> <p>Returns the value of <a data-link-type="dfn" href="#textdecoder-ignore-bom-flag" id="ref-for-textdecoder-ignore-bom-flag④">ignore BOM</a>. </p> <dt><code><var>decoder</var> . <a class="idl-code" data-link-type="attribute" href="https://streams.spec.whatwg.org/#dom-generictransformstream-readable" id="ref-for-dom-generictransformstream-readable">readable</a></code> <dd> <p>Returns a <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#readable-stream" id="ref-for-readable-stream">readable stream</a> whose <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#chunk" id="ref-for-chunk">chunks</a> are strings resulting from running <a data-link-type="dfn" href="#textdecoder-encoding" id="ref-for-textdecoder-encoding⑧">encoding</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder①⑤">decoder</a> on the chunks written to <code class="idl"><a data-link-type="idl" href="https://streams.spec.whatwg.org/#dom-generictransformstream-writable" id="ref-for-dom-generictransformstream-writable">writable</a></code>. </p> <dt><code><var>decoder</var> . <a class="idl-code" data-link-type="attribute" href="https://streams.spec.whatwg.org/#dom-generictransformstream-writable" id="ref-for-dom-generictransformstream-writable①">writable</a></code> <dd> <p>Returns a <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#writable-stream" id="ref-for-writable-stream">writable stream</a> which accepts <code><a class="idl-code" data-link-type="typedef" href="https://webidl.spec.whatwg.org/#AllowSharedBufferSource" id="ref-for-AllowSharedBufferSource①">AllowSharedBufferSource</a></code> chunks and runs them through <a data-link-type="dfn" href="#textdecoder-encoding" id="ref-for-textdecoder-encoding⑨">encoding</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder①⑥">decoder</a> before making them available to <code class="idl"><a data-link-type="idl" href="https://streams.spec.whatwg.org/#dom-generictransformstream-readable" id="ref-for-dom-generictransformstream-readable①">readable</a></code>. </p> <p>Typically this will be used via the <code class="idl"><a data-link-type="idl" href="https://streams.spec.whatwg.org/#rs-pipe-through" id="ref-for-rs-pipe-through">pipeThrough()</a></code> method on a <code class="idl"><a data-link-type="idl" href="https://streams.spec.whatwg.org/#readablestream" id="ref-for-readablestream">ReadableStream</a></code> source. </p> <pre class="example" id="example-textdecoderstream-writable"><a class="self-link" href="#example-textdecoderstream-writable"></a><code class="lang-javascript highlight"><c- a>var</c-> decoder <c- o>=</c-> <c- ow>new</c-> TextDecoderStream<c- p>(</c->encoding<c- p>);</c-> byteReadable <c- p>.</c->pipeThrough<c- p>(</c->decoder<c- p>)</c-> <c- p>.</c->pipeTo<c- p>(</c->textWritable<c- p>);</c-></code></pre> <p>If the <a data-link-type="dfn" href="#textdecoder-error-mode" id="ref-for-textdecoder-error-mode⑥">error mode</a> is "<code>fatal</code>" and <a data-link-type="dfn" href="#textdecoder-encoding" id="ref-for-textdecoder-encoding①⓪">encoding</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder①⑦">decoder</a> returns <a data-link-type="dfn" href="#error" id="ref-for-error①②">error</a>, both <code class="idl"><a data-link-type="idl" href="https://streams.spec.whatwg.org/#dom-generictransformstream-readable" id="ref-for-dom-generictransformstream-readable②">readable</a></code> and <code class="idl"><a data-link-type="idl" href="https://streams.spec.whatwg.org/#dom-generictransformstream-writable" id="ref-for-dom-generictransformstream-writable②">writable</a></code> will be errored with a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror②">TypeError</a></code>. </p> </dl> <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="TextDecoderStream" data-dfn-type="constructor" data-export data-lt="TextDecoderStream(label, options)|constructor(label, options)|TextDecoderStream(label)|constructor(label)|TextDecoderStream()|constructor()" id="dom-textdecoderstream"><code>new TextDecoderStream(<var>label</var>, <var>options</var>)</code></dfn> constructor steps are: </p> <ol> <li> <p>Let <var>encoding</var> be the result of <a data-link-type="dfn" href="#concept-encoding-get" id="ref-for-concept-encoding-get②">getting an encoding</a> from <var>label</var>. </p> <li> <p>If <var>encoding</var> is failure or <a data-link-type="dfn" href="#replacement" id="ref-for-replacement⑧">replacement</a>, then <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-throw" id="ref-for-dfn-throw⑤">throw</a> a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-rangeerror" id="ref-for-exceptiondef-rangeerror③">RangeError</a></code>. </p> <li> <p>Set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②②">this</a>’s <a data-link-type="dfn" href="#textdecoder-encoding" id="ref-for-textdecoder-encoding①①">encoding</a> to <var>encoding</var>. </p> <li> <p>If <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-textdecoderoptions-fatal" id="ref-for-dom-textdecoderoptions-fatal①">fatal</a></code>"] is true, then set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②③">this</a>’s <a data-link-type="dfn" href="#textdecoder-error-mode" id="ref-for-textdecoder-error-mode⑦">error mode</a> to "<code>fatal</code>". </p> <li> <p>Set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②④">this</a>’s <a data-link-type="dfn" href="#textdecoder-ignore-bom-flag" id="ref-for-textdecoder-ignore-bom-flag⑤">ignore BOM</a> to <var>options</var>["<code class="idl"><a data-link-type="idl" href="#dom-textdecoderoptions-ignorebom" id="ref-for-dom-textdecoderoptions-ignorebom①">ignoreBOM</a></code>"]. </p> <li> <p>Set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②⑤">this</a>’s <a data-link-type="dfn" href="#textdecodercommon-decoder" id="ref-for-textdecodercommon-decoder③">decoder</a> to a new instance of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②⑥">this</a>’s <a data-link-type="dfn" href="#textdecoder-encoding" id="ref-for-textdecoder-encoding①②">encoding</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder①⑧">decoder</a>, and set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②⑦">this</a>’s <a data-link-type="dfn" href="#textdecodercommon-i-o-queue" id="ref-for-textdecodercommon-i-o-queue④">I/O queue</a> to a new <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream②⑧">I/O queue</a>. </p> <li> <p>Let <var>transformAlgorithm</var> be an algorithm which takes a <var>chunk</var> argument and runs the <a data-link-type="dfn" href="#decode-and-enqueue-a-chunk" id="ref-for-decode-and-enqueue-a-chunk">decode and enqueue a chunk</a> algorithm with <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②⑧">this</a> and <var>chunk</var>. </p> <li> <p>Let <var>flushAlgorithm</var> be an algorithm which takes no arguments and runs the <a data-link-type="dfn" href="#flush-and-enqueue" id="ref-for-flush-and-enqueue">flush and enqueue</a> algorithm with <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this②⑨">this</a>. </p> <li> <p>Let <var>transformStream</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new">new</a> <code class="idl"><a data-link-type="idl" href="https://streams.spec.whatwg.org/#transformstream" id="ref-for-transformstream">TransformStream</a></code>. </p> <li> <p><a data-link-type="dfn" href="https://streams.spec.whatwg.org/#transformstream-set-up" id="ref-for-transformstream-set-up">Set up</a> <var>transformStream</var> with <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#transformstream-set-up-transformalgorithm" id="ref-for-transformstream-set-up-transformalgorithm"><var>transformAlgorithm</var></a> set to <var>transformAlgorithm</var> and <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#transformstream-set-up-flushalgorithm" id="ref-for-transformstream-set-up-flushalgorithm"><var>flushAlgorithm</var></a> set to <var>flushAlgorithm</var>. </p> <li> <p>Set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this③⓪">this</a>’s <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#generictransformstream-transform" id="ref-for-generictransformstream-transform">transform</a> to <var>transformStream</var>. </p> </ol> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="decode-and-enqueue-a-chunk">decode and enqueue a chunk</dfn> algorithm, given a <code class="idl"><a data-link-type="idl" href="#textdecoderstream" id="ref-for-textdecoderstream⑤">TextDecoderStream</a></code> object <var>decoder</var> and a <var>chunk</var>, runs these steps: </p> <ol> <li> <p>Let <var>bufferSource</var> be the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-convert-ecmascript-to-idl-value" id="ref-for-dfn-convert-ecmascript-to-idl-value">converting</a> <var>chunk</var> to an <code><a class="idl-code" data-link-type="typedef" href="https://webidl.spec.whatwg.org/#AllowSharedBufferSource" id="ref-for-AllowSharedBufferSource②">AllowSharedBufferSource</a></code>. </p> <li> <p><a data-link-type="dfn" href="#concept-stream-push" id="ref-for-concept-stream-push⑨">Push</a> a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-get-buffer-source-copy" id="ref-for-dfn-get-buffer-source-copy①">copy of</a> <var>bufferSource</var> to <var>decoder</var>’s <a data-link-type="dfn" href="#textdecodercommon-i-o-queue" id="ref-for-textdecodercommon-i-o-queue⑤">I/O queue</a>. </p> <p class="warning">See the <a href="#sharedarraybuffer-warning">warning for <code>SharedArrayBuffer</code> objects</a> above. </p> <li> <p>Let <var>output</var> be the <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream②⑨">I/O queue</a> of scalar values « <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream②⑥">end-of-queue</a> ». </p> <li> <p>While true: </p> <ol> <li> <p>Let <var>item</var> be the result of <a data-link-type="dfn" href="#concept-stream-read" id="ref-for-concept-stream-read①②">reading</a> from <var>decoder</var>’s <a data-link-type="dfn" href="#textdecodercommon-i-o-queue" id="ref-for-textdecodercommon-i-o-queue⑥">I/O queue</a>. </p> <li> <p>If <var>item</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream②⑦">end-of-queue</a>, then: </p> <ol> <li> <p>Let <var>outputChunk</var> be the result of running <a data-link-type="dfn" href="#concept-td-serialize" id="ref-for-concept-td-serialize②">serialize I/O queue</a> with <var>decoder</var> and <var>output</var>. </p> <li> <p>If <var>outputChunk</var> is non-empty, then <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#transformstream-enqueue" id="ref-for-transformstream-enqueue">enqueue</a> <var>outputChunk</var> in <var>decoder</var>’s <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#generictransformstream-transform" id="ref-for-generictransformstream-transform①">transform</a>. </p> <li> <p>Return. </p> </ol> <li> <p>Let <var>result</var> be the result of <a data-link-type="dfn" href="#concept-encoding-process" id="ref-for-concept-encoding-process③">processing an item</a> with <var>item</var>, <var>decoder</var>’s <a data-link-type="dfn" href="#textdecodercommon-decoder" id="ref-for-textdecodercommon-decoder④">decoder</a>, <var>decoder</var>’s <a data-link-type="dfn" href="#textdecodercommon-i-o-queue" id="ref-for-textdecodercommon-i-o-queue⑦">I/O queue</a>, <var>output</var>, and <var>decoder</var>’s <a data-link-type="dfn" href="#textdecoder-error-mode" id="ref-for-textdecoder-error-mode⑧">error mode</a>. </p> <li> <p>If <var>result</var> is <a data-link-type="dfn" href="#error" id="ref-for-error①③">error</a>, then <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-throw" id="ref-for-dfn-throw⑥">throw</a> a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror③">TypeError</a></code>. </p> </ol> </ol> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="flush-and-enqueue">flush and enqueue</dfn> algorithm, which handles the end of data from the input <code class="idl"><a data-link-type="idl" href="https://streams.spec.whatwg.org/#readablestream" id="ref-for-readablestream①">ReadableStream</a></code> object, given a <code class="idl"><a data-link-type="idl" href="#textdecoderstream" id="ref-for-textdecoderstream⑥">TextDecoderStream</a></code> object <var>decoder</var>, runs these steps: </p> <ol> <li> <p>Let <var>output</var> be the <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream③⓪">I/O queue</a> of scalar values « <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream②⑧">end-of-queue</a> ». </p> <li> <p>While true: </p> <ol> <li> <p>Let <var>item</var> be the result of <a data-link-type="dfn" href="#concept-stream-read" id="ref-for-concept-stream-read①③">reading</a> from <var>decoder</var>’s <a data-link-type="dfn" href="#textdecodercommon-i-o-queue" id="ref-for-textdecodercommon-i-o-queue⑧">I/O queue</a>. </p> <li> <p>Let <var>result</var> be the result of <a data-link-type="dfn" href="#concept-encoding-process" id="ref-for-concept-encoding-process④">processing an item</a> with <var>item</var>, <var>decoder</var>’s <a data-link-type="dfn" href="#textdecodercommon-decoder" id="ref-for-textdecodercommon-decoder⑤">decoder</a>, <var>decoder</var>’s <a data-link-type="dfn" href="#textdecodercommon-i-o-queue" id="ref-for-textdecodercommon-i-o-queue⑨">I/O queue</a>, <var>output</var>, and <var>decoder</var>’s <a data-link-type="dfn" href="#textdecoder-error-mode" id="ref-for-textdecoder-error-mode⑨">error mode</a>. </p> <li> <p>If <var>result</var> is <a data-link-type="dfn" href="#finished" id="ref-for-finished④">finished</a>, then: </p> <ol> <li> <p>Let <var>outputChunk</var> be the result of running <a data-link-type="dfn" href="#concept-td-serialize" id="ref-for-concept-td-serialize③">serialize I/O queue</a> with <var>decoder</var> and <var>output</var>. </p> <li> <p>If <var>outputChunk</var> is non-empty, then <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#transformstream-enqueue" id="ref-for-transformstream-enqueue①">enqueue</a> <var>outputChunk</var> in <var>decoder</var>’s <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#generictransformstream-transform" id="ref-for-generictransformstream-transform②">transform</a>. </p> <li> <p>Return. </p> </ol> <li> <p>Otherwise, if <var>result</var> is <a data-link-type="dfn" href="#error" id="ref-for-error①④">error</a>, <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-throw" id="ref-for-dfn-throw⑦">throw</a> a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror④">TypeError</a></code>. </p> </ol> </ol> <h3 class="heading settled" data-level="7.6" id="interface-textencoderstream"><span class="secno">7.6. </span><span class="content">Interface <code class="idl"><a data-link-type="idl" href="#textencoderstream" id="ref-for-textencoderstream①">TextEncoderStream</a></code></span><a class="self-link" href="#interface-textencoderstream"></a></h3> <pre class="idl highlight def">[Exposed=*] <c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="textencoderstream"><code><c- g>TextEncoderStream</c-></code></dfn> { <a class="idl-code" data-link-type="constructor" href="#dom-textencoderstream" id="ref-for-dom-textencoderstream"><c- g>constructor</c-></a>(); }; <a data-link-type="idl-name" href="#textencoderstream" id="ref-for-textencoderstream②"><c- n>TextEncoderStream</c-></a> <c- b>includes</c-> <a data-link-type="idl-name" href="#textencodercommon" id="ref-for-textencodercommon③"><c- n>TextEncoderCommon</c-></a>; <a data-link-type="idl-name" href="#textencoderstream" id="ref-for-textencoderstream③"><c- n>TextEncoderStream</c-></a> <c- b>includes</c-> <a data-link-type="idl-name" href="https://streams.spec.whatwg.org/#generictransformstream" id="ref-for-generictransformstream①"><c- n>GenericTransformStream</c-></a>; </pre> <p>A <code class="idl"><a data-link-type="idl" href="#textencoderstream" id="ref-for-textencoderstream④">TextEncoderStream</a></code> object has an associated: </p> <dl> <dt><dfn class="dfn-paneled" data-dfn-for="TextEncoderStream" data-dfn-type="dfn" data-noexport id="textencoderstream-encoder">encoder</dfn> <dd>An <a data-link-type="dfn" href="#encoder" id="ref-for-encoder①⑤">encoder</a> instance. <dt><dfn class="dfn-paneled" data-dfn-for="TextEncoderStream" data-dfn-type="dfn" data-noexport id="textencoderstream-pending-high-surrogate">leading surrogate</dfn> <dd>Null or a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#leading-surrogate" id="ref-for-leading-surrogate①">leading surrogate</a>, initially null. </dl> <p class="note no-backref" role="note">A <code class="idl"><a data-link-type="idl" href="#textencoderstream" id="ref-for-textencoderstream⑤">TextEncoderStream</a></code> object offers no <var>label</var> argument as it only supports <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8①⑧">UTF-8</a>. </p> <dl class="domintro"> <dt><code><var>encoder</var> = new <a class="idl-code" data-link-type="constructor" href="#dom-textencoderstream" id="ref-for-dom-textencoderstream①">TextEncoderStream()</a></code> <dd> <p>Returns a new <code class="idl"><a data-link-type="idl" href="#textencoderstream" id="ref-for-textencoderstream⑥">TextEncoderStream</a></code> object. </p> <dt><code><var>encoder</var> . <a class="idl-code" data-link-type="attribute" href="#dom-textencoder-encoding" id="ref-for-dom-textencoder-encoding②">encoding</a></code> <dd> <p>Returns "<code>utf-8</code>". </p> <dt><code><var>encoder</var> . <a class="idl-code" data-link-type="attribute" href="https://streams.spec.whatwg.org/#dom-generictransformstream-readable" id="ref-for-dom-generictransformstream-readable③">readable</a></code> <dd> <p>Returns a <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#readable-stream" id="ref-for-readable-stream①">readable stream</a> whose <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#chunk" id="ref-for-chunk①">chunks</a> are <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-Uint8Array" id="ref-for-idl-Uint8Array④">Uint8Array</a></code>s resulting from running <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8①⑨">UTF-8</a>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder①⑥">encoder</a> on the chunks written to <code class="idl"><a data-link-type="idl" href="https://streams.spec.whatwg.org/#dom-generictransformstream-writable" id="ref-for-dom-generictransformstream-writable③">writable</a></code>. </p> <dt><code><var>encoder</var> . <a class="idl-code" data-link-type="attribute" href="https://streams.spec.whatwg.org/#dom-generictransformstream-writable" id="ref-for-dom-generictransformstream-writable④">writable</a></code> <dd> <p>Returns a <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#writable-stream" id="ref-for-writable-stream①">writable stream</a> which accepts string chunks and runs them through <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8②⓪">UTF-8</a>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder①⑦">encoder</a> before making them available to <code class="idl"><a data-link-type="idl" href="https://streams.spec.whatwg.org/#dom-generictransformstream-readable" id="ref-for-dom-generictransformstream-readable④">readable</a></code>. </p> <p>Typically this will be used via the <code class="idl"><a data-link-type="idl" href="https://streams.spec.whatwg.org/#rs-pipe-through" id="ref-for-rs-pipe-through①">pipeThrough()</a></code> method on a <code class="idl"><a data-link-type="idl" href="https://streams.spec.whatwg.org/#readablestream" id="ref-for-readablestream②">ReadableStream</a></code> source. </p> <pre class="example" id="example-textencoderstream-writable"><a class="self-link" href="#example-textencoderstream-writable"></a><code class="lang-javascript highlight">textReadable <c- p>.</c->pipeThrough<c- p>(</c-><c- ow>new</c-> TextEncoderStream<c- p>())</c-> <c- p>.</c->pipeTo<c- p>(</c->byteWritable<c- p>);</c-></code></pre> </dl> <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="TextEncoderStream" data-dfn-type="constructor" data-export data-lt="TextEncoderStream()|constructor()" id="dom-textencoderstream"><code>new TextEncoderStream()</code></dfn> constructor steps are: </p> <ol> <li> <p>Set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this③①">this</a>’s <a data-link-type="dfn" href="#textencoderstream-encoder" id="ref-for-textencoderstream-encoder">encoder</a> to an instance of the <a data-link-type="dfn" href="#utf-8-encoder" id="ref-for-utf-8-encoder⑤">UTF-8 encoder</a>. </p> <li> <p>Let <var>transformAlgorithm</var> be an algorithm which takes a <var>chunk</var> argument and runs the <a data-link-type="dfn" href="#encode-and-enqueue-a-chunk" id="ref-for-encode-and-enqueue-a-chunk">encode and enqueue a chunk</a> algorithm with <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this③②">this</a> and <var>chunk</var>. </p> <li> <p>Let <var>flushAlgorithm</var> be an algorithm which runs the <a data-link-type="dfn" href="#encode-and-flush" id="ref-for-encode-and-flush">encode and flush</a> algorithm with <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this③③">this</a>. </p> <li> <p>Let <var>transformStream</var> be a <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#new" id="ref-for-new①">new</a> <code class="idl"><a data-link-type="idl" href="https://streams.spec.whatwg.org/#transformstream" id="ref-for-transformstream①">TransformStream</a></code>. </p> <li> <p><a data-link-type="dfn" href="https://streams.spec.whatwg.org/#transformstream-set-up" id="ref-for-transformstream-set-up①">Set up</a> <var>transformStream</var> with <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#transformstream-set-up-transformalgorithm" id="ref-for-transformstream-set-up-transformalgorithm①"><var>transformAlgorithm</var></a> set to <var>transformAlgorithm</var> and <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#transformstream-set-up-flushalgorithm" id="ref-for-transformstream-set-up-flushalgorithm①"><var>flushAlgorithm</var></a> set to <var>flushAlgorithm</var>. </p> <li> <p>Set <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this③④">this</a>’s <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#generictransformstream-transform" id="ref-for-generictransformstream-transform③">transform</a> to <var>transformStream</var>. </p> </ol> <hr> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="encode-and-enqueue-a-chunk">encode and enqueue a chunk</dfn> algorithm, given a <code class="idl"><a data-link-type="idl" href="#textencoderstream" id="ref-for-textencoderstream⑦">TextEncoderStream</a></code> object <var>encoder</var> and <var>chunk</var>, runs these steps: </p> <ol> <li> <p>Let <var>input</var> be the result of <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#dfn-convert-ecmascript-to-idl-value" id="ref-for-dfn-convert-ecmascript-to-idl-value①">converting</a> <var>chunk</var> to a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString④">DOMString</a></code>. </p> <li> <p><a data-link-type="dfn" href="#to-i-o-queue-convert" id="ref-for-to-i-o-queue-convert②">Convert</a> <var>input</var> to an <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream③①">I/O queue</a> of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-unit" id="ref-for-code-unit①">code units</a>. </p> <p class="note" role="note"><code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-DOMString" id="ref-for-idl-DOMString⑤">DOMString</a></code>, as well as an <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream③②">I/O queue</a> of code units rather than scalar values, are used here so that a surrogate pair that is split between chunks can be reassembled into the appropriate scalar value. The behavior is otherwise identical to <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-USVString" id="ref-for-idl-USVString③">USVString</a></code>. In particular, lone surrogates will be replaced with U+FFFD. </p> <li> <p>Let <var>output</var> be the <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream③③">I/O queue</a> of bytes « <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream②⑨">end-of-queue</a> ». </p> <li> <p>While true: </p> <ol> <li> <p>Let <var>item</var> be the result of <a data-link-type="dfn" href="#concept-stream-read" id="ref-for-concept-stream-read①④">reading</a> from <var>input</var>. </p> <li> <p>If <var>item</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream③⓪">end-of-queue</a>, then: </p> <ol> <li> <p><a data-link-type="dfn" href="#from-i-o-queue-convert" id="ref-for-from-i-o-queue-convert①">Convert</a> <var>output</var> into a byte sequence. </p> <li> <p>If <var>output</var> is non-empty, then: </p> <ol> <li> <p>Let <var>chunk</var> be a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-Uint8Array" id="ref-for-idl-Uint8Array⑤">Uint8Array</a></code> object wrapping an <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer" id="ref-for-idl-ArrayBuffer④">ArrayBuffer</a></code> containing <var>output</var>. </p> <li> <p><a data-link-type="dfn" href="https://streams.spec.whatwg.org/#transformstream-enqueue" id="ref-for-transformstream-enqueue②">Enqueue</a> <var>chunk</var> into <var>encoder</var>’s <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#generictransformstream-transform" id="ref-for-generictransformstream-transform④">transform</a>. </p> </ol> <li> <p>Return. </p> </ol> <li> <p>Let <var>result</var> be the result of executing the <a data-link-type="dfn" href="#convert-code-unit-to-scalar-value" id="ref-for-convert-code-unit-to-scalar-value">convert code unit to scalar value</a> algorithm with <var>encoder</var>, <var>item</var> and <var>input</var>. </p> <li> <p>If <var>result</var> is not <a data-link-type="dfn" href="#continue" id="ref-for-continue②">continue</a>, then <a data-link-type="dfn" href="#concept-encoding-process" id="ref-for-concept-encoding-process⑤">process an item</a> with <var>result</var>, <var>encoder</var>’s <a data-link-type="dfn" href="#textencoderstream-encoder" id="ref-for-textencoderstream-encoder①">encoder</a>, <var>input</var>, <var>output</var>, and "<code>fatal</code>". </p> </ol> </ol> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="convert-code-unit-to-scalar-value">convert code unit to scalar value</dfn> algorithm, given a <code class="idl"><a data-link-type="idl" href="#textencoderstream" id="ref-for-textencoderstream⑧">TextEncoderStream</a></code> object <var>encoder</var>, a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-unit" id="ref-for-code-unit②">code unit</a> <var>item</var>, and an <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream③④">I/O queue</a> of code units <var>input</var>, runs these steps: </p> <ol> <li> <p>If <var>encoder</var>’s <a data-link-type="dfn" href="#textencoderstream-pending-high-surrogate" id="ref-for-textencoderstream-pending-high-surrogate">leading surrogate</a> is non-null, then: </p> <ol> <li> <p>Let <var>leadingSurrogate</var> be <var>encoder</var>’s <a data-link-type="dfn" href="#textencoderstream-pending-high-surrogate" id="ref-for-textencoderstream-pending-high-surrogate①">leading surrogate</a>. </p> <li> <p>Set <var>encoder</var>’s <a data-link-type="dfn" href="#textencoderstream-pending-high-surrogate" id="ref-for-textencoderstream-pending-high-surrogate②">leading surrogate</a> to null. </p> <li> <p>If <var>item</var> is a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#trailing-surrogate" id="ref-for-trailing-surrogate①">trailing surrogate</a>, then return a <a data-link-type="dfn" href="#scalar-value-from-surrogates" id="ref-for-scalar-value-from-surrogates">scalar value from surrogates</a> given <var>leadingSurrogate</var> and <var>item</var>. </p> <li> <p><a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend②">Restore</a> <var>item</var> to <var>input</var>. </p> <li> <p>Return U+FFFD. </p> </ol> <li> <p>If <var>item</var> is a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#leading-surrogate" id="ref-for-leading-surrogate②">leading surrogate</a>, then set <var>encoder</var>’s <a data-link-type="dfn" href="#textencoderstream-pending-high-surrogate" id="ref-for-textencoderstream-pending-high-surrogate③">leading surrogate</a> to <var>item</var> and return <a data-link-type="dfn" href="#continue" id="ref-for-continue③">continue</a>. </p> <li> <p>If <var>item</var> is a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#trailing-surrogate" id="ref-for-trailing-surrogate②">trailing surrogate</a>, then return U+FFFD. </p> <li> <p>Return <var>item</var>. </p> </ol> <p class="note" role="note">This is equivalent to the "<a data-link-type="dfn" href="https://infra.spec.whatwg.org/#javascript-string-convert" id="ref-for-javascript-string-convert">convert</a> a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#string" id="ref-for-string②">string</a> into a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#scalar-value-string" id="ref-for-scalar-value-string">scalar value string</a>" algorithm from the Infra Standard, but allows for surrogate pairs that are split between strings. <a data-link-type="biblio" href="#biblio-infra" title="Infra Standard">[INFRA]</a> </p> <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="encode-and-flush">encode and flush</dfn> algorithm, given a <code class="idl"><a data-link-type="idl" href="#textencoderstream" id="ref-for-textencoderstream⑨">TextEncoderStream</a></code> object <var>encoder</var>, runs these steps: </p> <ol> <li> <p>If <var>encoder</var>’s <a data-link-type="dfn" href="#textencoderstream-pending-high-surrogate" id="ref-for-textencoderstream-pending-high-surrogate④">leading surrogate</a> is non-null, then: </p> <ol> <li> <p>Let <var>chunk</var> be a <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-Uint8Array" id="ref-for-idl-Uint8Array⑥">Uint8Array</a></code> object wrapping an <code class="idl"><a data-link-type="idl" href="https://webidl.spec.whatwg.org/#idl-ArrayBuffer" id="ref-for-idl-ArrayBuffer⑤">ArrayBuffer</a></code> containing 0xEF 0xBF 0xBD. </p> <p class="note" role="note">This is U+FFFD (�) in <a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8②①">UTF-8</a> bytes. </p> <li> <p><a data-link-type="dfn" href="https://streams.spec.whatwg.org/#transformstream-enqueue" id="ref-for-transformstream-enqueue③">Enqueue</a> <var>chunk</var> into <var>encoder</var>’s <a data-link-type="dfn" href="https://streams.spec.whatwg.org/#generictransformstream-transform" id="ref-for-generictransformstream-transform⑤">transform</a>. </p> </ol> </ol> <h2 class="heading settled" data-level="8" id="the-encoding"><span class="secno">8. </span><span class="content">The encoding</span><a class="self-link" href="#the-encoding"></a></h2> <h3 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="8.1" data-lt="UTF-8" id="utf-8"><span class="secno">8.1. </span><span class="content">UTF-8</span><a class="self-link" href="#utf-8" id="ref-for-utf-8②⑤"></a></h3> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="8.1.1" data-lt="UTF-8 decoder" id="utf-8-decoder"><span class="secno">8.1.1. </span><span class="content">UTF-8 decoder</span><a class="self-link" href="#utf-8-decoder" id="ref-for-utf-8-decoder"></a></h4> <p class="note" role="note">A byte order mark has priority over a label as it has been found to be more accurate in deployed content. Therefore it is not part of the <a data-link-type="dfn" href="#utf-8-decoder" id="ref-for-utf-8-decoder②">UTF-8 decoder</a> algorithm, but rather the <a data-link-type="dfn" href="#decode" id="ref-for-decode⑤">decode</a> and <a data-link-type="dfn" href="#utf-8-decode" id="ref-for-utf-8-decode③">UTF-8 decode</a> algorithms. </p> <p><a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8②②">UTF-8</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder①⑨">decoder</a> has an associated <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="utf-8-code-point">UTF-8 code point</dfn>, <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="utf-8-bytes-seen">UTF-8 bytes seen</dfn>, and <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="utf-8-bytes-needed">UTF-8 bytes needed</dfn> (all initially 0), a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="utf-8-lower-boundary">UTF-8 lower boundary</dfn> (initially 0x80), and a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="utf-8-upper-boundary">UTF-8 upper boundary</dfn> (initially 0xBF). </p> <p><a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8②③">UTF-8</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder②⓪">decoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler④">handler</a>, given <var>ioQueue</var> and <var>byte</var>, runs these steps: </p> <ol> <li> <p>If <var>byte</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream③①">end-of-queue</a> and <a data-link-type="dfn" href="#utf-8-bytes-needed" id="ref-for-utf-8-bytes-needed">UTF-8 bytes needed</a> is not 0, set <a data-link-type="dfn" href="#utf-8-bytes-needed" id="ref-for-utf-8-bytes-needed①">UTF-8 bytes needed</a> to 0 and return <a data-link-type="dfn" href="#error" id="ref-for-error①⑤">error</a>. </p> <li> <p>If <var>byte</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream③②">end-of-queue</a>, return <a data-link-type="dfn" href="#finished" id="ref-for-finished⑤">finished</a>. </p> <li> <p>If <a data-link-type="dfn" href="#utf-8-bytes-needed" id="ref-for-utf-8-bytes-needed②">UTF-8 bytes needed</a> is 0, based on <var>byte</var>: </p> <dl class="switch"> <dt>0x00 to 0x7F <dd> <p>Return a code point whose value is <var>byte</var>. </p> <dt>0xC2 to 0xDF <dd> <ol> <li> <p>Set <a data-link-type="dfn" href="#utf-8-bytes-needed" id="ref-for-utf-8-bytes-needed③">UTF-8 bytes needed</a> to 1. </p> <li> <p>Set <a data-link-type="dfn" href="#utf-8-code-point" id="ref-for-utf-8-code-point">UTF-8 code point</a> to <var>byte</var> &amp; 0x1F. </p> <p class="note" role="note">The five least significant bits of <var>byte</var>. </p> </ol> <dt>0xE0 to 0xEF <dd> <ol> <li> <p>If <var>byte</var> is 0xE0, set <a data-link-type="dfn" href="#utf-8-lower-boundary" id="ref-for-utf-8-lower-boundary">UTF-8 lower boundary</a> to 0xA0. </p> <li> <p>If <var>byte</var> is 0xED, set <a data-link-type="dfn" href="#utf-8-upper-boundary" id="ref-for-utf-8-upper-boundary">UTF-8 upper boundary</a> to 0x9F. </p> <li> <p>Set <a data-link-type="dfn" href="#utf-8-bytes-needed" id="ref-for-utf-8-bytes-needed④">UTF-8 bytes needed</a> to 2. </p> <li> <p>Set <a data-link-type="dfn" href="#utf-8-code-point" id="ref-for-utf-8-code-point①">UTF-8 code point</a> to <var>byte</var> &amp; 0xF. </p> <p class="note" role="note">The four least significant bits of <var>byte</var>. </p> </ol> <dt>0xF0 to 0xF4 <dd> <ol> <li> <p>If <var>byte</var> is 0xF0, set <a data-link-type="dfn" href="#utf-8-lower-boundary" id="ref-for-utf-8-lower-boundary①">UTF-8 lower boundary</a> to 0x90. </p> <li> <p>If <var>byte</var> is 0xF4, set <a data-link-type="dfn" href="#utf-8-upper-boundary" id="ref-for-utf-8-upper-boundary①">UTF-8 upper boundary</a> to 0x8F. </p> <li> <p>Set <a data-link-type="dfn" href="#utf-8-bytes-needed" id="ref-for-utf-8-bytes-needed⑤">UTF-8 bytes needed</a> to 3. </p> <li> <p>Set <a data-link-type="dfn" href="#utf-8-code-point" id="ref-for-utf-8-code-point②">UTF-8 code point</a> to <var>byte</var> &amp; 0x7. </p> <p class="note" role="note">The three least significant bits of <var>byte</var>. </p> </ol> <dt>Otherwise <dd> <p>Return <a data-link-type="dfn" href="#error" id="ref-for-error①⑥">error</a>. </p> </dl> <p>Return <a data-link-type="dfn" href="#continue" id="ref-for-continue④">continue</a>. </p> <li> <p>If <var>byte</var> is not in the range <a data-link-type="dfn" href="#utf-8-lower-boundary" id="ref-for-utf-8-lower-boundary②">UTF-8 lower boundary</a> to <a data-link-type="dfn" href="#utf-8-upper-boundary" id="ref-for-utf-8-upper-boundary②">UTF-8 upper boundary</a>, inclusive, then: </p> <ol> <li> <p>Set <a data-link-type="dfn" href="#utf-8-code-point" id="ref-for-utf-8-code-point③">UTF-8 code point</a>, <a data-link-type="dfn" href="#utf-8-bytes-needed" id="ref-for-utf-8-bytes-needed⑥">UTF-8 bytes needed</a>, and <a data-link-type="dfn" href="#utf-8-bytes-seen" id="ref-for-utf-8-bytes-seen">UTF-8 bytes seen</a> to 0, set <a data-link-type="dfn" href="#utf-8-lower-boundary" id="ref-for-utf-8-lower-boundary③">UTF-8 lower boundary</a> to 0x80, and set <a data-link-type="dfn" href="#utf-8-upper-boundary" id="ref-for-utf-8-upper-boundary③">UTF-8 upper boundary</a> to 0xBF. </p> <li> <p><a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend③">Restore</a> <var>byte</var> to <var>ioQueue</var>. </p> <li> <p>Return <a data-link-type="dfn" href="#error" id="ref-for-error①⑦">error</a>. </p> </ol> <li> <p>Set <a data-link-type="dfn" href="#utf-8-lower-boundary" id="ref-for-utf-8-lower-boundary④">UTF-8 lower boundary</a> to 0x80 and <a data-link-type="dfn" href="#utf-8-upper-boundary" id="ref-for-utf-8-upper-boundary④">UTF-8 upper boundary</a> to 0xBF. </p> <li> <p>Set <a data-link-type="dfn" href="#utf-8-code-point" id="ref-for-utf-8-code-point④">UTF-8 code point</a> to (<a data-link-type="dfn" href="#utf-8-code-point" id="ref-for-utf-8-code-point⑤">UTF-8 code point</a> &lt;&lt; 6) | (<var>byte</var> &amp; 0x3F) </p> <p class="note no-backref" role="note">Shift the existing bits of <a data-link-type="dfn" href="#utf-8-code-point" id="ref-for-utf-8-code-point⑥">UTF-8 code point</a> left by six places and set the newly-vacated six least significant bits to the six least significant bits of <var>byte</var>. </p> <li> <p>Increase <a data-link-type="dfn" href="#utf-8-bytes-seen" id="ref-for-utf-8-bytes-seen①">UTF-8 bytes seen</a> by one. </p> <li> <p>If <a data-link-type="dfn" href="#utf-8-bytes-seen" id="ref-for-utf-8-bytes-seen②">UTF-8 bytes seen</a> is not equal to <a data-link-type="dfn" href="#utf-8-bytes-needed" id="ref-for-utf-8-bytes-needed⑦">UTF-8 bytes needed</a>, return <a data-link-type="dfn" href="#continue" id="ref-for-continue⑤">continue</a>. </p> <li> <p>Let <var>code point</var> be <a data-link-type="dfn" href="#utf-8-code-point" id="ref-for-utf-8-code-point⑦">UTF-8 code point</a>. </p> <li> <p>Set <a data-link-type="dfn" href="#utf-8-code-point" id="ref-for-utf-8-code-point⑧">UTF-8 code point</a>, <a data-link-type="dfn" href="#utf-8-bytes-needed" id="ref-for-utf-8-bytes-needed⑧">UTF-8 bytes needed</a>, and <a data-link-type="dfn" href="#utf-8-bytes-seen" id="ref-for-utf-8-bytes-seen③">UTF-8 bytes seen</a> to 0. </p> <li> <p>Return a code point whose value is <var>code point</var>. </p> </ol> <p class="note" role="note">The constraints in the <a data-link-type="dfn" href="#utf-8-decoder" id="ref-for-utf-8-decoder①">UTF-8 decoder</a> above match “Best Practices for Using U+FFFD” from the Unicode standard. No other behavior is permitted per the Encoding Standard (other algorithms that achieve the same result are fine, even encouraged). <a data-link-type="biblio" href="#biblio-unicode" title="The Unicode Standard">[UNICODE]</a> </p> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="8.1.2" data-lt="UTF-8 encoder" id="utf-8-encoder"><span class="secno">8.1.2. </span><span class="content">UTF-8 encoder</span><a class="self-link" href="#utf-8-encoder" id="ref-for-utf-8-encoder⑥"></a></h4> <p><a data-link-type="dfn" href="#utf-8" id="ref-for-utf-8②④">UTF-8</a>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder①⑧">encoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler⑤">handler</a>, given <var>ioQueue</var> and <var>code point</var>, runs these steps: </p> <ol> <li> <p>If <var>code point</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream③③">end-of-queue</a>, return <a data-link-type="dfn" href="#finished" id="ref-for-finished⑥">finished</a>. </p> <li> <p>If <var>code point</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-code-point" id="ref-for-ascii-code-point①">ASCII code point</a>, return a byte whose value is <var>code point</var>. </p> <li> <p>Set <var>count</var> and <var>offset</var> based on the range <var>code point</var> is in: </p> <dl class="switch"> <dt>U+0080 to U+07FF, inclusive <dd>1 and 0xC0 <dt>U+0800 to U+FFFF, inclusive <dd>2 and 0xE0 <dt>U+10000 to U+10FFFF, inclusive <dd>3 and 0xF0 </dl> <li> <p>Let <var>bytes</var> be a byte sequence whose first byte is (<var>code point</var> >> (6 × <var>count</var>)) + <var>offset</var>. </p> <li> <p>While <var>count</var> is greater than 0: </p> <ol> <li> <p>Set <var>temp</var> to <var>code point</var> >> (6 × (<var>count</var> − 1)). </p> <li> <p>Append to <var>bytes</var> 0x80 | (<var>temp</var> &amp; 0x3F). </p> <li> <p>Decrease <var>count</var> by one. </p> </ol> <li> <p>Return bytes <var>bytes</var>, in order. </p> </ol> <p class="note" role="note">This algorithm has identical results to the one described in the Unicode standard. It is included here for completeness. <a data-link-type="biblio" href="#biblio-unicode" title="The Unicode Standard">[UNICODE]</a> </p> <h2 class="heading settled" data-level="9" id="legacy-single-byte-encodings"><span class="secno">9. </span><span class="content">Legacy single-byte encodings</span><a class="self-link" href="#legacy-single-byte-encodings"></a></h2> <p>An <a data-link-type="dfn" href="#encoding" id="ref-for-encoding②⑦">encoding</a> where each byte is either a single code point or nothing, is a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="single-byte-encoding">single-byte encoding</dfn>. <a data-link-type="dfn" href="#single-byte-encoding" id="ref-for-single-byte-encoding①">Single-byte encodings</a> share the <a data-link-type="dfn" href="#decoder" id="ref-for-decoder②①">decoder</a> and <a data-link-type="dfn" href="#encoder" id="ref-for-encoder①⑨">encoder</a>. <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="index-single-byte">Index single-byte</dfn>, as referenced by the <a data-link-type="dfn" href="#single-byte-decoder" id="ref-for-single-byte-decoder">single-byte decoder</a> and <a data-link-type="dfn" href="#single-byte-encoder" id="ref-for-single-byte-encoder">single-byte encoder</a>, is defined by the following table, and depends on the <a data-link-type="dfn" href="#single-byte-encoding" id="ref-for-single-byte-encoding②">single-byte encoding</a> in use. All but two <a data-link-type="dfn" href="#single-byte-encoding" id="ref-for-single-byte-encoding③">single-byte encodings</a> have a unique <a data-link-type="dfn" href="#index" id="ref-for-index①①">index</a>. </p> <table> <tbody> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="ibm866">IBM866</dfn> <td><a href="index-ibm866.txt">index-ibm866.txt</a> <td><a href="ibm866.html">index IBM866 visualization</a> <td><a href="ibm866-bmp.html">index IBM866 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="iso-8859-2">ISO-8859-2</dfn> <td><a href="index-iso-8859-2.txt">index-iso-8859-2.txt</a> <td><a href="iso-8859-2.html">index ISO-8859-2 visualization</a> <td><a href="iso-8859-2-bmp.html">index ISO-8859-2 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="iso-8859-3">ISO-8859-3</dfn> <td><a href="index-iso-8859-3.txt">index-iso-8859-3.txt</a> <td><a href="iso-8859-3.html">index ISO-8859-3 visualization</a> <td><a href="iso-8859-3-bmp.html">index ISO-8859-3 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="iso-8859-4">ISO-8859-4</dfn> <td><a href="index-iso-8859-4.txt">index-iso-8859-4.txt</a> <td><a href="iso-8859-4.html">index ISO-8859-4 visualization</a> <td><a href="iso-8859-4-bmp.html">index ISO-8859-4 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="iso-8859-5">ISO-8859-5</dfn> <td><a href="index-iso-8859-5.txt">index-iso-8859-5.txt</a> <td><a href="iso-8859-5.html">index ISO-8859-5 visualization</a> <td><a href="iso-8859-5-bmp.html">index ISO-8859-5 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="iso-8859-6">ISO-8859-6</dfn> <td><a href="index-iso-8859-6.txt">index-iso-8859-6.txt</a> <td><a href="iso-8859-6.html">index ISO-8859-6 visualization</a> <td><a href="iso-8859-6-bmp.html">index ISO-8859-6 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="iso-8859-7">ISO-8859-7</dfn> <td><a href="index-iso-8859-7.txt">index-iso-8859-7.txt</a> <td><a href="iso-8859-7.html">index ISO-8859-7 visualization</a> <td><a href="iso-8859-7-bmp.html">index ISO-8859-7 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="iso-8859-8">ISO-8859-8</dfn> <td rowspan="2"><a href="index-iso-8859-8.txt">index-iso-8859-8.txt</a> <td rowspan="2"><a href="iso-8859-8.html">index ISO-8859-8 visualization</a> <td rowspan="2"><a href="iso-8859-8-bmp.html">index ISO-8859-8 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="iso-8859-8-i">ISO-8859-8-I</dfn> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="iso-8859-10">ISO-8859-10</dfn> <td><a href="index-iso-8859-10.txt">index-iso-8859-10.txt</a> <td><a href="iso-8859-10.html">index ISO-8859-10 visualization</a> <td><a href="iso-8859-10-bmp.html">index ISO-8859-10 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="iso-8859-13">ISO-8859-13</dfn> <td><a href="index-iso-8859-13.txt">index-iso-8859-13.txt</a> <td><a href="iso-8859-13.html">index ISO-8859-13 visualization</a> <td><a href="iso-8859-13-bmp.html">index ISO-8859-13 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="iso-8859-14">ISO-8859-14</dfn> <td><a href="index-iso-8859-14.txt">index-iso-8859-14.txt</a> <td><a href="iso-8859-14.html">index ISO-8859-14 visualization</a> <td><a href="iso-8859-14-bmp.html">index ISO-8859-14 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="iso-8859-15">ISO-8859-15</dfn> <td><a href="index-iso-8859-15.txt">index-iso-8859-15.txt</a> <td><a href="iso-8859-15.html">index ISO-8859-15 visualization</a> <td><a href="iso-8859-15-bmp.html">index ISO-8859-15 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="iso-8859-16">ISO-8859-16</dfn> <td><a href="index-iso-8859-16.txt">index-iso-8859-16.txt</a> <td><a href="iso-8859-16.html">index ISO-8859-16 visualization</a> <td><a href="iso-8859-16-bmp.html">index ISO-8859-16 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="koi8-r">KOI8-R</dfn> <td><a href="index-koi8-r.txt">index-koi8-r.txt</a> <td><a href="koi8-r.html">index KOI8-R visualization</a> <td><a href="koi8-r-bmp.html">index KOI8-R BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="koi8-u">KOI8-U</dfn> <td><a href="index-koi8-u.txt">index-koi8-u.txt</a> <td><a href="koi8-u.html">index KOI8-U visualization</a> <td><a href="koi8-u-bmp.html">index KOI8-U BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="macintosh">macintosh</dfn> <td><a href="index-macintosh.txt">index-macintosh.txt</a> <td><a href="macintosh.html">index macintosh visualization</a> <td><a href="macintosh-bmp.html">index macintosh BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="windows-874">windows-874</dfn> <td><a href="index-windows-874.txt">index-windows-874.txt</a> <td><a href="windows-874.html">index windows-874 visualization</a> <td><a href="windows-874-bmp.html">index windows-874 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="windows-1250">windows-1250</dfn> <td><a href="index-windows-1250.txt">index-windows-1250.txt</a> <td><a href="windows-1250.html">index windows-1250 visualization</a> <td><a href="windows-1250-bmp.html">index windows-1250 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="windows-1251">windows-1251</dfn> <td><a href="index-windows-1251.txt">index-windows-1251.txt</a> <td><a href="windows-1251.html">index windows-1251 visualization</a> <td><a href="windows-1251-bmp.html">index windows-1251 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="windows-1252">windows-1252</dfn> <td><a href="index-windows-1252.txt">index-windows-1252.txt</a> <td><a href="windows-1252.html">index windows-1252 visualization</a> <td><a href="windows-1252-bmp.html">index windows-1252 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="windows-1253">windows-1253</dfn> <td><a href="index-windows-1253.txt">index-windows-1253.txt</a> <td><a href="windows-1253.html">index windows-1253 visualization</a> <td><a href="windows-1253-bmp.html">index windows-1253 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="windows-1254">windows-1254</dfn> <td><a href="index-windows-1254.txt">index-windows-1254.txt</a> <td><a href="windows-1254.html">index windows-1254 visualization</a> <td><a href="windows-1254-bmp.html">index windows-1254 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="windows-1255">windows-1255</dfn> <td><a href="index-windows-1255.txt">index-windows-1255.txt</a> <td><a href="windows-1255.html">index windows-1255 visualization</a> <td><a href="windows-1255-bmp.html">index windows-1255 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="windows-1256">windows-1256</dfn> <td><a href="index-windows-1256.txt">index-windows-1256.txt</a> <td><a href="windows-1256.html">index windows-1256 visualization</a> <td><a href="windows-1256-bmp.html">index windows-1256 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="windows-1257">windows-1257</dfn> <td><a href="index-windows-1257.txt">index-windows-1257.txt</a> <td><a href="windows-1257.html">index windows-1257 visualization</a> <td><a href="windows-1257-bmp.html">index windows-1257 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="windows-1258">windows-1258</dfn> <td><a href="index-windows-1258.txt">index-windows-1258.txt</a> <td><a href="windows-1258.html">index windows-1258 visualization</a> <td><a href="windows-1258-bmp.html">index windows-1258 BMP coverage</a> <tr> <td><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="x-mac-cyrillic">x-mac-cyrillic</dfn> <td><a href="index-x-mac-cyrillic.txt">index-x-mac-cyrillic.txt</a> <td><a href="x-mac-cyrillic.html">index x-mac-cyrillic visualization</a> <td><a href="x-mac-cyrillic-bmp.html">index x-mac-cyrillic BMP coverage</a> </table> <p class="note" role="note"><a data-link-type="dfn" href="#iso-8859-8" id="ref-for-iso-8859-8①">ISO-8859-8</a> and <a data-link-type="dfn" href="#iso-8859-8-i" id="ref-for-iso-8859-8-i①">ISO-8859-8-I</a> are distinct <a data-link-type="dfn" href="#encoding" id="ref-for-encoding②⑧">encoding</a> <a data-link-type="dfn" href="#name" id="ref-for-name⑤">names</a>, because <a data-link-type="dfn" href="#iso-8859-8" id="ref-for-iso-8859-8②">ISO-8859-8</a> has influence on the layout direction. And although historically this might have been the case for <a data-link-type="dfn" href="#iso-8859-6" id="ref-for-iso-8859-6①">ISO-8859-6</a> and "ISO-8859-6-I" as well, that is no longer true. </p> <h3 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="9.1" data-lt="single-byte decoder" id="single-byte-decoder"><span class="secno">9.1. </span><span class="content">single-byte decoder</span><a class="self-link" href="#single-byte-decoder" id="ref-for-single-byte-decoder①"></a></h3> <p><a data-link-type="dfn" href="#single-byte-encoding" id="ref-for-single-byte-encoding④">Single-byte encodings</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder②②">decoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler⑥">handler</a>, given <var>ioQueue</var> and <var>byte</var>, runs these steps: </p> <ol> <li> <p>If <var>byte</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream③④">end-of-queue</a>, return <a data-link-type="dfn" href="#finished" id="ref-for-finished⑦">finished</a>. </p> <li> <p>If <var>byte</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-byte" id="ref-for-ascii-byte①">ASCII byte</a>, return a code point whose value is <var>byte</var>. </p> <li> <p>Let <var>code point</var> be the <a data-link-type="dfn" href="#index-code-point" id="ref-for-index-code-point">index code point</a> for <var>byte</var> − 0x80 in <a data-link-type="dfn" href="#index-single-byte" id="ref-for-index-single-byte①">index single-byte</a>. </p> <li> <p>If <var>code point</var> is null, return <a data-link-type="dfn" href="#error" id="ref-for-error①⑧">error</a>. </p> <li> <p>Return a code point whose value is <var>code point</var>. </p> </ol> <h3 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="9.2" data-lt="single-byte encoder" id="single-byte-encoder"><span class="secno">9.2. </span><span class="content">single-byte encoder</span><a class="self-link" href="#single-byte-encoder" id="ref-for-single-byte-encoder①"></a></h3> <p><a data-link-type="dfn" href="#single-byte-encoding" id="ref-for-single-byte-encoding⑤">Single-byte encodings</a>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder②⓪">encoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler⑦">handler</a>, given <var>ioQueue</var> and <var>code point</var>, runs these steps: </p> <ol> <li> <p>If <var>code point</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream③⑤">end-of-queue</a>, return <a data-link-type="dfn" href="#finished" id="ref-for-finished⑧">finished</a>. </p> <li> <p>If <var>code point</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-code-point" id="ref-for-ascii-code-point②">ASCII code point</a>, return a byte whose value is <var>code point</var>. </p> <li> <p>Let <var>pointer</var> be the <a data-link-type="dfn" href="#index-pointer" id="ref-for-index-pointer②">index pointer</a> for <var>code point</var> in <a data-link-type="dfn" href="#index-single-byte" id="ref-for-index-single-byte②">index single-byte</a>. </p> <li> <p>If <var>pointer</var> is null, return <a data-link-type="dfn" href="#error" id="ref-for-error①⑨">error</a> with <var>code point</var>. </p> <li> <p>Return a byte whose value is <var>pointer</var> + 0x80. </p> </ol> <h2 class="heading settled" data-level="10" id="legacy-multi-byte-chinese-(simplified)-encodings"><span class="secno">10. </span><span class="content">Legacy multi-byte Chinese (simplified) encodings</span><a class="self-link" href="#legacy-multi-byte-chinese-(simplified)-encodings"></a></h2> <h3 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="10.1" data-lt="GBK" id="gbk"><span class="secno">10.1. </span><span class="content">GBK</span><a class="self-link" href="#gbk" id="ref-for-gbk⑤"></a></h3> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="10.1.1" data-lt="GBK decoder" id="gbk-decoder"><span class="secno">10.1.1. </span><span class="content">GBK decoder</span><a class="self-link" href="#gbk-decoder" id="ref-for-gbk-decoder"></a></h4> <p><a data-link-type="dfn" href="#gbk" id="ref-for-gbk①">GBK</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder②③">decoder</a> is <a data-link-type="dfn" href="#gb18030" id="ref-for-gb18030①">gb18030</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder②④">decoder</a>. </p> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="10.1.2" data-lt="GBK encoder" id="gbk-encoder"><span class="secno">10.1.2. </span><span class="content">GBK encoder</span><a class="self-link" href="#gbk-encoder" id="ref-for-gbk-encoder"></a></h4> <p><a data-link-type="dfn" href="#gbk" id="ref-for-gbk②">GBK</a>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder②①">encoder</a> is <a data-link-type="dfn" href="#gb18030" id="ref-for-gb18030②">gb18030</a>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder②②">encoder</a> with its <a data-link-type="dfn" href="#gbk-flag" id="ref-for-gbk-flag">is GBK</a> set to true. </p> <p class="note no-backref" role="note">Not fully aliasing <a data-link-type="dfn" href="#gbk" id="ref-for-gbk③">GBK</a> with <a data-link-type="dfn" href="#gb18030" id="ref-for-gb18030③">gb18030</a> is a conservative move to decrease the chances of breaking legacy servers and other consumers of content generated with <a data-link-type="dfn" href="#gbk" id="ref-for-gbk④">GBK</a>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder②③">encoder</a>. </p> <h3 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="10.2" data-lt="gb18030" id="gb18030"><span class="secno">10.2. </span><span class="content">gb18030</span><a class="self-link" href="#gb18030" id="ref-for-gb18030①①"></a></h3> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="10.2.1" data-lt="gb18030 decoder" id="gb18030-decoder"><span class="secno">10.2.1. </span><span class="content">gb18030 decoder</span><a class="self-link" href="#gb18030-decoder" id="ref-for-gb18030-decoder①"></a></h4> <p><a data-link-type="dfn" href="#gb18030" id="ref-for-gb18030④">gb18030</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder②⑤">decoder</a> has an associated <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="gb18030-first">gb18030 first</dfn>, <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="gb18030-second">gb18030 second</dfn>, and <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="gb18030-third">gb18030 third</dfn> (all initially 0x00). </p> <p><a data-link-type="dfn" href="#gb18030" id="ref-for-gb18030⑤">gb18030</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder②⑥">decoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler⑧">handler</a>, given <var>ioQueue</var> and <var>byte</var>, runs these steps: </p> <ol> <li> <p>If <var>byte</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream③⑥">end-of-queue</a> and <a data-link-type="dfn" href="#gb18030-first" id="ref-for-gb18030-first">gb18030 first</a>, <a data-link-type="dfn" href="#gb18030-second" id="ref-for-gb18030-second">gb18030 second</a>, and <a data-link-type="dfn" href="#gb18030-third" id="ref-for-gb18030-third">gb18030 third</a> are 0x00, return <a data-link-type="dfn" href="#finished" id="ref-for-finished⑨">finished</a>. </p> <li> <p>If <var>byte</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream③⑦">end-of-queue</a>, and <a data-link-type="dfn" href="#gb18030-first" id="ref-for-gb18030-first①">gb18030 first</a>, <a data-link-type="dfn" href="#gb18030-second" id="ref-for-gb18030-second①">gb18030 second</a>, or <a data-link-type="dfn" href="#gb18030-third" id="ref-for-gb18030-third①">gb18030 third</a> is not 0x00, set <a data-link-type="dfn" href="#gb18030-first" id="ref-for-gb18030-first②">gb18030 first</a>, <a data-link-type="dfn" href="#gb18030-second" id="ref-for-gb18030-second②">gb18030 second</a>, and <a data-link-type="dfn" href="#gb18030-third" id="ref-for-gb18030-third②">gb18030 third</a> to 0x00, and return <a data-link-type="dfn" href="#error" id="ref-for-error②⓪">error</a>. </p> <li> <p>If <a data-link-type="dfn" href="#gb18030-third" id="ref-for-gb18030-third③">gb18030 third</a> is not 0x00, then: </p> <ol> <li> <p>If <var>byte</var> is not in the range 0x30 to 0x39, inclusive, then: </p> <ol> <li> <p><a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend④">Restore</a> « <a data-link-type="dfn" href="#gb18030-second" id="ref-for-gb18030-second③">gb18030 second</a>, <a data-link-type="dfn" href="#gb18030-third" id="ref-for-gb18030-third④">gb18030 third</a>, <var>byte</var> » to <var>ioQueue</var>. </p> <li> <p>Set <a data-link-type="dfn" href="#gb18030-first" id="ref-for-gb18030-first③">gb18030 first</a>, <a data-link-type="dfn" href="#gb18030-second" id="ref-for-gb18030-second④">gb18030 second</a>, and <a data-link-type="dfn" href="#gb18030-third" id="ref-for-gb18030-third⑤">gb18030 third</a> to 0x00. </p> <li> <p>Return <a data-link-type="dfn" href="#error" id="ref-for-error②①">error</a>. </p> </ol> <li> <p>Let <var>code point</var> be the <a data-link-type="dfn" href="#index-gb18030-ranges-code-point" id="ref-for-index-gb18030-ranges-code-point①">index gb18030 ranges code point</a> for ((<a data-link-type="dfn" href="#gb18030-first" id="ref-for-gb18030-first④">gb18030 first</a> − 0x81) × (10 × 126 × 10)) + ((<a data-link-type="dfn" href="#gb18030-second" id="ref-for-gb18030-second⑤">gb18030 second</a> − 0x30) × (10 × 126)) + ((<a data-link-type="dfn" href="#gb18030-third" id="ref-for-gb18030-third⑥">gb18030 third</a> − 0x81) × 10) + <var>byte</var> − 0x30. </p> <li> <p>Set <a data-link-type="dfn" href="#gb18030-first" id="ref-for-gb18030-first⑤">gb18030 first</a>, <a data-link-type="dfn" href="#gb18030-second" id="ref-for-gb18030-second⑥">gb18030 second</a>, and <a data-link-type="dfn" href="#gb18030-third" id="ref-for-gb18030-third⑦">gb18030 third</a> to 0x00. </p> <li> <p>If <var>code point</var> is null, return <a data-link-type="dfn" href="#error" id="ref-for-error②②">error</a>. </p> <li> <p>Return a code point whose value is <var>code point</var>. </p> </ol> <li> <p>If <a data-link-type="dfn" href="#gb18030-second" id="ref-for-gb18030-second⑦">gb18030 second</a> is not 0x00, then: </p> <ol> <li> <p>If <var>byte</var> is in the range 0x81 to 0xFE, inclusive, set <a data-link-type="dfn" href="#gb18030-third" id="ref-for-gb18030-third⑧">gb18030 third</a> to <var>byte</var> and return <a data-link-type="dfn" href="#continue" id="ref-for-continue⑥">continue</a>. </p> <li> <p><a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend⑤">Restore</a> « <a data-link-type="dfn" href="#gb18030-second" id="ref-for-gb18030-second⑧">gb18030 second</a>, <var>byte</var> » to <var>ioQueue</var>, set <a data-link-type="dfn" href="#gb18030-first" id="ref-for-gb18030-first⑥">gb18030 first</a> and <a data-link-type="dfn" href="#gb18030-second" id="ref-for-gb18030-second⑨">gb18030 second</a> to 0x00, and return <a data-link-type="dfn" href="#error" id="ref-for-error②③">error</a>. </p> </ol> <li> <p>If <a data-link-type="dfn" href="#gb18030-first" id="ref-for-gb18030-first⑦">gb18030 first</a> is not 0x00, then: </p> <ol> <li> <p>If <var>byte</var> is in the range 0x30 to 0x39, inclusive, set <a data-link-type="dfn" href="#gb18030-second" id="ref-for-gb18030-second①⓪">gb18030 second</a> to <var>byte</var> and return <a data-link-type="dfn" href="#continue" id="ref-for-continue⑦">continue</a>. </p> <li> <p>Let <var>lead</var> be <a data-link-type="dfn" href="#gb18030-first" id="ref-for-gb18030-first⑧">gb18030 first</a>, let <var>pointer</var> be null, and set <a data-link-type="dfn" href="#gb18030-first" id="ref-for-gb18030-first⑨">gb18030 first</a> to 0x00. </p> <li> <p>Let <var>offset</var> be 0x40 if <var>byte</var> is less than 0x7F, otherwise 0x41. </p> <li> <p>If <var>byte</var> is in the range 0x40 to 0x7E, inclusive, or 0x80 to 0xFE, inclusive, set <var>pointer</var> to (<var>lead</var> − 0x81) × 190 + (<var>byte</var> − <var>offset</var>). </p> <li> <p>Let <var>code point</var> be null if <var>pointer</var> is null, otherwise the <a data-link-type="dfn" href="#index-code-point" id="ref-for-index-code-point①">index code point</a> for <var>pointer</var> in <a data-link-type="dfn" href="#index-gb18030" id="ref-for-index-gb18030">index gb18030</a>. </p> <li> <p>If <var>code point</var> is non-null, return a code point whose value is <var>code point</var>. </p> <li> <p>If <var>byte</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-byte" id="ref-for-ascii-byte②">ASCII byte</a>, <a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend⑥">restore</a> <var>byte</var> to <var>ioQueue</var>. </p> <li> <p>Return <a data-link-type="dfn" href="#error" id="ref-for-error②④">error</a>. </p> </ol> <li> <p>If <var>byte</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-byte" id="ref-for-ascii-byte③">ASCII byte</a>, return a code point whose value is <var>byte</var>. </p> <li> <p>If <var>byte</var> is 0x80, return code point U+20AC. </p> <li> <p>If <var>byte</var> is in the range 0x81 to 0xFE, inclusive, set <a data-link-type="dfn" href="#gb18030-first" id="ref-for-gb18030-first①⓪">gb18030 first</a> to <var>byte</var> and return <a data-link-type="dfn" href="#continue" id="ref-for-continue⑧">continue</a>. </p> <li> <p>Return <a data-link-type="dfn" href="#error" id="ref-for-error②⑤">error</a>. </p> </ol> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="10.2.2" data-lt="gb18030 encoder" id="gb18030-encoder"><span class="secno">10.2.2. </span><span class="content">gb18030 encoder</span><a class="self-link" href="#gb18030-encoder" id="ref-for-gb18030-encoder①"></a></h4> <p><a data-link-type="dfn" href="#gb18030" id="ref-for-gb18030⑥">gb18030</a>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder②④">encoder</a> has an associated <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="gbk-flag">is GBK</dfn> (initially false). </p> <p><a data-link-type="dfn" href="#gb18030" id="ref-for-gb18030⑦">gb18030</a>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder②⑤">encoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler⑨">handler</a>, given <var>ioQueue</var> and <var>code point</var>, runs these steps: </p> <ol> <li> <p>If <var>code point</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream③⑧">end-of-queue</a>, return <a data-link-type="dfn" href="#finished" id="ref-for-finished①⓪">finished</a>. </p> <li> <p>If <var>code point</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-code-point" id="ref-for-ascii-code-point③">ASCII code point</a>, return a byte whose value is <var>code point</var>. </p> <li> <p>If <var>code point</var> is U+E5E5, return <a data-link-type="dfn" href="#error" id="ref-for-error②⑥">error</a> with <var>code point</var>. </p> <p class="note" role="note"><a data-link-type="dfn" href="#index-gb18030" id="ref-for-index-gb18030①">Index gb18030</a> maps 0xA3 0xA0 to U+3000 rather than U+E5E5 for compatibility with deployed content. Therefore it cannot roundtrip. </p> <li> <p>If <a data-link-type="dfn" href="#gbk-flag" id="ref-for-gbk-flag①">is GBK</a> is true and <var>code point</var> is U+20AC, return byte 0x80. </p> <li> <p>If there is a row in the table below whose first column is <var>code point</var>, then return the two bytes on the same row listed in the second column: </p> <table> <tbody> <tr> <th>Code point <th>Bytes <tr> <td>U+E78D <td>0xA6 0xD9 <tr> <td>U+E78E <td>0xA6 0xDA <tr> <td>U+E78F <td>0xA6 0xDB <tr> <td>U+E790 <td>0xA6 0xDC <tr> <td>U+E791 <td>0xA6 0xDD <tr> <td>U+E792 <td>0xA6 0xDE <tr> <td>U+E793 <td>0xA6 0xDF <tr> <td>U+E794 <td>0xA6 0xEC <tr> <td>U+E795 <td>0xA6 0xED <tr> <td>U+E796 <td>0xA6 0xF3 <tr> <td>U+E81E <td>0xFE 0x59 <tr> <td>U+E826 <td>0xFE 0x61 <tr> <td>U+E82B <td>0xFE 0x66 <tr> <td>U+E82C <td>0xFE 0x67 <tr> <td>U+E832 <td>0xFE 0x6D <tr> <td>U+E843 <td>0xFE 0x7E <tr> <td>U+E854 <td>0xFE 0x90 <tr> <td>U+E864 <td>0xFE 0xA0 </table> <p class="note" role="note">This asymmetric encoder table preserves compatibility with the GB18030-2005 standard. See also the explanation at <a data-link-type="dfn" href="#index-gb18030-ranges" id="ref-for-index-gb18030-ranges⑤">index gb18030 ranges</a>. </p> <li> <p>Let <var>pointer</var> be the <a data-link-type="dfn" href="#index-pointer" id="ref-for-index-pointer③">index pointer</a> for <var>code point</var> in <a data-link-type="dfn" href="#index-gb18030" id="ref-for-index-gb18030②">index gb18030</a>. </p> <li> <p>If <var>pointer</var> is non-null, then: </p> <ol> <li> <p>Let <var>lead</var> be <var>pointer</var> / 190 + 0x81. </p> <li> <p>Let <var>trail</var> be <var>pointer</var> % 190. </p> <li> <p>Let <var>offset</var> be 0x40 if <var>trail</var> is less than 0x3F, otherwise 0x41. </p> <li> <p>Return two bytes whose values are <var>lead</var> and <var>trail</var> + <var>offset</var>. </p> </ol> <li> <p>If <a data-link-type="dfn" href="#gbk-flag" id="ref-for-gbk-flag②">is GBK</a> is true, return <a data-link-type="dfn" href="#error" id="ref-for-error②⑦">error</a> with <var>code point</var>. </p> <li> <p>Set <var>pointer</var> to the <a data-link-type="dfn" href="#index-gb18030-ranges-pointer" id="ref-for-index-gb18030-ranges-pointer①">index gb18030 ranges pointer</a> for <var>code point</var>. </p> <li> <p>Let <var>byte1</var> be <var>pointer</var> / (10 × 126 × 10). </p> <li> <p>Set <var>pointer</var> to <var>pointer</var> % (10 × 126 × 10). </p> <li> <p>Let <var>byte2</var> be <var>pointer</var> / (10 × 126). </p> <li> <p>Set <var>pointer</var> to <var>pointer</var> % (10 × 126). </p> <li> <p>Let <var>byte3</var> be <var>pointer</var> / 10. </p> <li> <p>Let <var>byte4</var> be <var>pointer</var> % 10. </p> <li> <p>Return four bytes whose values are <var>byte1</var> + 0x81, <var>byte2</var> + 0x30, <var>byte3</var> + 0x81, <var>byte4</var> + 0x30. </p> </ol> <h2 class="heading settled" data-level="11" id="legacy-multi-byte-chinese-(traditional)-encodings"><span class="secno">11. </span><span class="content">Legacy multi-byte Chinese (traditional) encodings</span><a class="self-link" href="#legacy-multi-byte-chinese-(traditional)-encodings"></a></h2> <h3 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="11.1" data-lt="Big5" id="big5"><span class="secno">11.1. </span><span class="content">Big5</span><a class="self-link" href="#big5" id="ref-for-big5④"></a></h3> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="11.1.1" data-lt="Big5 decoder" id="big5-decoder"><span class="secno">11.1.1. </span><span class="content">Big5 decoder</span><a class="self-link" href="#big5-decoder" id="ref-for-big5-decoder"></a></h4> <p><a data-link-type="dfn" href="#big5" id="ref-for-big5①">Big5</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder②⑦">decoder</a> has an associated <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="big5-lead">Big5 lead</dfn> (initially 0x00). </p> <p><a data-link-type="dfn" href="#big5" id="ref-for-big5②">Big5</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder②⑧">decoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler①⓪">handler</a>, given <var>ioQueue</var> and <var>byte</var>, runs these steps:</p> <ol> <li> <p>If <var>byte</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream③⑨">end-of-queue</a> and <a data-link-type="dfn" href="#big5-lead" id="ref-for-big5-lead">Big5 lead</a> is not 0x00, set <a data-link-type="dfn" href="#big5-lead" id="ref-for-big5-lead①">Big5 lead</a> to 0x00 and return <a data-link-type="dfn" href="#error" id="ref-for-error②⑧">error</a>. </p> <li> <p>If <var>byte</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream④⓪">end-of-queue</a> and <a data-link-type="dfn" href="#big5-lead" id="ref-for-big5-lead②">Big5 lead</a> is 0x00, return <a data-link-type="dfn" href="#finished" id="ref-for-finished①①">finished</a>. </p> <li> <p>If <a data-link-type="dfn" href="#big5-lead" id="ref-for-big5-lead③">Big5 lead</a> is not 0x00, let <var>lead</var> be <a data-link-type="dfn" href="#big5-lead" id="ref-for-big5-lead④">Big5 lead</a>, let <var>pointer</var> be null, set <a data-link-type="dfn" href="#big5-lead" id="ref-for-big5-lead⑤">Big5 lead</a> to 0x00, and then: </p> <ol> <li> <p>Let <var>offset</var> be 0x40 if <var>byte</var> is less than 0x7F, otherwise 0x62. </p> <li> <p>If <var>byte</var> is in the range 0x40 to 0x7E, inclusive, or 0xA1 to 0xFE, inclusive, set <var>pointer</var> to (<var>lead</var> − 0x81) × 157 + (<var>byte</var> − <var>offset</var>). </p> <li> <p>If there is a row in the table below whose first column is <var>pointer</var>, return the <em>two</em> code points listed in its second column (the third column is irrelevant): </p> <table> <tbody> <tr> <th>Pointer <th>Code points <th>Notes <tr> <td>1133 <td>U+00CA U+0304 <td>Ê̄ (LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND MACRON) <tr> <td>1135 <td>U+00CA U+030C <td>Ê̌ (LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND CARON) <tr> <td>1164 <td>U+00EA U+0304 <td>ê̄ (LATIN SMALL LETTER E WITH CIRCUMFLEX AND MACRON) <tr> <td>1166 <td>U+00EA U+030C <td>ê̌ (LATIN SMALL LETTER E WITH CIRCUMFLEX AND CARON) </table> <p class="note" role="note">Since <a data-link-type="dfn" href="#index" id="ref-for-index①②">indexes</a> are limited to single code points this table is used for these pointers. </p> <li> <p>Let <var>code point</var> be null if <var>pointer</var> is null, otherwise the <a data-link-type="dfn" href="#index-code-point" id="ref-for-index-code-point②">index code point</a> for <var>pointer</var> in <a data-link-type="dfn" href="#index-big5" id="ref-for-index-big5①">index Big5</a>. </p> <li> <p>If <var>code point</var> is non-null, return a code point whose value is <var>code point</var>. </p> <li> <p>If <var>byte</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-byte" id="ref-for-ascii-byte④">ASCII byte</a>, <a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend⑦">restore</a> <var>byte</var> to <var>ioQueue</var>. </p> <li> <p>Return <a data-link-type="dfn" href="#error" id="ref-for-error②⑨">error</a>. </p> </ol> <li> <p>If <var>byte</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-byte" id="ref-for-ascii-byte⑤">ASCII byte</a>, return a code point whose value is <var>byte</var>. </p> <li> <p>If <var>byte</var> is in the range 0x81 to 0xFE, inclusive, set <a data-link-type="dfn" href="#big5-lead" id="ref-for-big5-lead⑥">Big5 lead</a> to <var>byte</var> and return <a data-link-type="dfn" href="#continue" id="ref-for-continue⑨">continue</a>. </p> <li> <p>Return <a data-link-type="dfn" href="#error" id="ref-for-error③⓪">error</a>. </p> </ol> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="11.1.2" data-lt="Big5 encoder" id="big5-encoder"><span class="secno">11.1.2. </span><span class="content">Big5 encoder</span><a class="self-link" href="#big5-encoder" id="ref-for-big5-encoder"></a></h4> <p><a data-link-type="dfn" href="#big5" id="ref-for-big5③">Big5</a>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder②⑥">encoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler①①">handler</a>, given <var>ioQueue</var> and <var>code point</var>, runs these steps: </p> <ol> <li> <p>If <var>code point</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream④①">end-of-queue</a>, return <a data-link-type="dfn" href="#finished" id="ref-for-finished①②">finished</a>. </p> <li> <p>If <var>code point</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-code-point" id="ref-for-ascii-code-point④">ASCII code point</a>, return a byte whose value is <var>code point</var>. </p> <li> <p>Let <var>pointer</var> be the <a data-link-type="dfn" href="#index-big5-pointer" id="ref-for-index-big5-pointer">index Big5 pointer</a> for <var>code point</var>. </p> <li> <p>If <var>pointer</var> is null, return <a data-link-type="dfn" href="#error" id="ref-for-error③①">error</a> with <var>code point</var>. </p> <li> <p>Let <var>lead</var> be <var>pointer</var> / 157 + 0x81. </p> <li> <p>Let <var>trail</var> be <var>pointer</var> % 157. </p> <li> <p>Let <var>offset</var> be 0x40 if <var>trail</var> is less than 0x3F, otherwise 0x62. </p> <li> <p>Return two bytes whose values are <var>lead</var> and <var>trail</var> + <var>offset</var>. </p> </ol> <h2 class="heading settled" data-level="12" id="legacy-multi-byte-japanese-encodings"><span class="secno">12. </span><span class="content">Legacy multi-byte Japanese encodings</span><a class="self-link" href="#legacy-multi-byte-japanese-encodings"></a></h2> <h3 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="12.1" data-lt="EUC-JP" id="euc-jp"><span class="secno">12.1. </span><span class="content">EUC-JP</span><a class="self-link" href="#euc-jp" id="ref-for-euc-jp④"></a></h3> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="12.1.1" data-lt="EUC-JP decoder" id="euc-jp-decoder"><span class="secno">12.1.1. </span><span class="content">EUC-JP decoder</span><a class="self-link" href="#euc-jp-decoder" id="ref-for-euc-jp-decoder①"></a></h4> <p><a data-link-type="dfn" href="#euc-jp" id="ref-for-euc-jp①">EUC-JP</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder②⑨">decoder</a> has an associated <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="euc-jp-jis0212-flag">EUC-JP jis0212</dfn> (initially false) and <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="euc-jp-lead">EUC-JP lead</dfn> (initially 0x00). </p> <p><a data-link-type="dfn" href="#euc-jp" id="ref-for-euc-jp②">EUC-JP</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder③⓪">decoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler①②">handler</a>, given <var>ioQueue</var> and <var>byte</var>, runs these steps: </p> <ol> <li> <p>If <var>byte</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream④②">end-of-queue</a> and <a data-link-type="dfn" href="#euc-jp-lead" id="ref-for-euc-jp-lead">EUC-JP lead</a> is not 0x00, set <a data-link-type="dfn" href="#euc-jp-lead" id="ref-for-euc-jp-lead①">EUC-JP lead</a> to 0x00, and return <a data-link-type="dfn" href="#error" id="ref-for-error③②">error</a>. </p> <li> <p>If <var>byte</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream④③">end-of-queue</a> and <a data-link-type="dfn" href="#euc-jp-lead" id="ref-for-euc-jp-lead②">EUC-JP lead</a> is 0x00, return <a data-link-type="dfn" href="#finished" id="ref-for-finished①③">finished</a>. </p> <li> <p>If <a data-link-type="dfn" href="#euc-jp-lead" id="ref-for-euc-jp-lead③">EUC-JP lead</a> is 0x8E and <var>byte</var> is in the range 0xA1 to 0xDF, inclusive, set <a data-link-type="dfn" href="#euc-jp-lead" id="ref-for-euc-jp-lead④">EUC-JP lead</a> to 0x00 and return a code point whose value is 0xFF61 − 0xA1 + <var>byte</var>. </p> <li> <p>If <a data-link-type="dfn" href="#euc-jp-lead" id="ref-for-euc-jp-lead⑤">EUC-JP lead</a> is 0x8F and <var>byte</var> is in the range 0xA1 to 0xFE, inclusive, set <a data-link-type="dfn" href="#euc-jp-jis0212-flag" id="ref-for-euc-jp-jis0212-flag">EUC-JP jis0212</a> to true, set <a data-link-type="dfn" href="#euc-jp-lead" id="ref-for-euc-jp-lead⑥">EUC-JP lead</a> to <var>byte</var>, and return <a data-link-type="dfn" href="#continue" id="ref-for-continue①⓪">continue</a>. </p> <li> <p>If <a data-link-type="dfn" href="#euc-jp-lead" id="ref-for-euc-jp-lead⑦">EUC-JP lead</a> is not 0x00, let <var>lead</var> be <a data-link-type="dfn" href="#euc-jp-lead" id="ref-for-euc-jp-lead⑧">EUC-JP lead</a>, set <a data-link-type="dfn" href="#euc-jp-lead" id="ref-for-euc-jp-lead⑨">EUC-JP lead</a> to 0x00, and then: </p> <ol> <li> <p>Let <var>code point</var> be null. </p> <li> <p>If <var>lead</var> and <var>byte</var> are both in the range 0xA1 to 0xFE, inclusive, then set <var>code point</var> to the <a data-link-type="dfn" href="#index-code-point" id="ref-for-index-code-point③">index code point</a> for (<var>lead</var> − 0xA1) × 94 + <var>byte</var> − 0xA1 in <a data-link-type="dfn" href="#index-jis0208" id="ref-for-index-jis0208③">index jis0208</a> if <a data-link-type="dfn" href="#euc-jp-jis0212-flag" id="ref-for-euc-jp-jis0212-flag①">EUC-JP jis0212</a> is false and in <a data-link-type="dfn" href="#index-jis0212" id="ref-for-index-jis0212">index jis0212</a> otherwise. </p> <li> <p>Set <a data-link-type="dfn" href="#euc-jp-jis0212-flag" id="ref-for-euc-jp-jis0212-flag②">EUC-JP jis0212</a> to false. </p> <li> <p>If <var>code point</var> is non-null, return a code point whose value is <var>code point</var>. </p> <li> <p>If <var>byte</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-byte" id="ref-for-ascii-byte⑥">ASCII byte</a>, <a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend⑧">restore</a> <var>byte</var> to <var>ioQueue</var>. </p> <li> <p>Return <a data-link-type="dfn" href="#error" id="ref-for-error③③">error</a>. </p> </ol> <li> <p>If <var>byte</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-byte" id="ref-for-ascii-byte⑦">ASCII byte</a>, return a code point whose value is <var>byte</var>. </p> <li> <p>If <var>byte</var> is 0x8E, 0x8F, or in the range 0xA1 to 0xFE, inclusive, set <a data-link-type="dfn" href="#euc-jp-lead" id="ref-for-euc-jp-lead①⓪">EUC-JP lead</a> to <var>byte</var> and return <a data-link-type="dfn" href="#continue" id="ref-for-continue①①">continue</a>. </p> <li> <p>Return <a data-link-type="dfn" href="#error" id="ref-for-error③④">error</a>. </p> </ol> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="12.1.2" data-lt="EUC-JP encoder" id="euc-jp-encoder"><span class="secno">12.1.2. </span><span class="content">EUC-JP encoder</span><a class="self-link" href="#euc-jp-encoder" id="ref-for-euc-jp-encoder"></a></h4> <p><a data-link-type="dfn" href="#euc-jp" id="ref-for-euc-jp③">EUC-JP</a>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder②⑦">encoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler①③">handler</a>, given <var>ioQueue</var> and <var>code point</var>, runs these steps: </p> <ol> <li> <p>If <var>code point</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream④④">end-of-queue</a>, return <a data-link-type="dfn" href="#finished" id="ref-for-finished①④">finished</a>. </p> <li> <p>If <var>code point</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-code-point" id="ref-for-ascii-code-point⑤">ASCII code point</a>, return a byte whose value is <var>code point</var>. </p> <li> <p>If <var>code point</var> is U+00A5, return byte 0x5C. </p> <li> <p>If <var>code point</var> is U+203E, return byte 0x7E. </p> <li> <p>If <var>code point</var> is in the range U+FF61 to U+FF9F, inclusive, return two bytes whose values are 0x8E and <var>code point</var> − 0xFF61 + 0xA1. </p> <li> <p>If <var>code point</var> is U+2212, set it to U+FF0D. </p> <li> <p>Let <var>pointer</var> be the <a data-link-type="dfn" href="#index-pointer" id="ref-for-index-pointer④">index pointer</a> for <var>code point</var> in <a data-link-type="dfn" href="#index-jis0208" id="ref-for-index-jis0208④">index jis0208</a>. </p> <p class="note" role="note">If <var>pointer</var> is non-null, it is less than 8836 due to the nature of <a data-link-type="dfn" href="#index-jis0208" id="ref-for-index-jis0208⑤">index jis0208</a> and the <a data-link-type="dfn" href="#index-pointer" id="ref-for-index-pointer⑤">index pointer</a> operation. </p> <li> <p>If <var>pointer</var> is null, return <a data-link-type="dfn" href="#error" id="ref-for-error③⑤">error</a> with <var>code point</var>. </p> <li> <p>Let <var>lead</var> be <var>pointer</var> / 94 + 0xA1. </p> <li> <p>Let <var>trail</var> be <var>pointer</var> % 94 + 0xA1. </p> <li> <p>Return two bytes whose values are <var>lead</var> and <var>trail</var>. </p> </ol> <h3 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="12.2" data-lt="ISO-2022-JP" id="iso-2022-jp"><span class="secno">12.2. </span><span class="content">ISO-2022-JP</span><a class="self-link" href="#iso-2022-jp" id="ref-for-iso-2022-jp⑦"></a></h3> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="12.2.1" data-lt="ISO-2022-JP decoder" id="iso-2022-jp-decoder"><span class="secno">12.2.1. </span><span class="content">ISO-2022-JP decoder</span><a class="self-link" href="#iso-2022-jp-decoder" id="ref-for-iso-2022-jp-decoder"></a></h4> <p><a data-link-type="dfn" href="#iso-2022-jp" id="ref-for-iso-2022-jp②">ISO-2022-JP</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder③①">decoder</a> has an associated <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="iso-2022-jp-decoder-state">ISO-2022-JP decoder state</dfn> (initially <a data-link-type="dfn" href="#iso-2022-jp-decoder-ascii" id="ref-for-iso-2022-jp-decoder-ascii">ASCII</a>), <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="iso-2022-jp-decoder-output-state">ISO-2022-JP decoder output state</dfn> (initially <a data-link-type="dfn" href="#iso-2022-jp-decoder-ascii" id="ref-for-iso-2022-jp-decoder-ascii①">ASCII</a>), <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="iso-2022-jp-lead">ISO-2022-JP lead</dfn> (initially 0x00), and <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="iso-2022-jp-output-flag">ISO-2022-JP output</dfn> (initially false). </p> <p><a data-link-type="dfn" href="#iso-2022-jp" id="ref-for-iso-2022-jp③">ISO-2022-JP</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder③②">decoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler①④">handler</a>, given <var>ioQueue</var> and <var>byte</var>, runs these steps, switching on <a data-link-type="dfn" href="#iso-2022-jp-decoder-state" id="ref-for-iso-2022-jp-decoder-state">ISO-2022-JP decoder state</a>: </p> <dl class="switch"> <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="ISO-2022-JP decoder ASCII" data-noexport id="iso-2022-jp-decoder-ascii">ASCII</dfn> <dd> <p>Based on <var>byte</var>: </p> <dl class="switch"> <dt>0x1B <dd> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-decoder-state" id="ref-for-iso-2022-jp-decoder-state①">ISO-2022-JP decoder state</a> to <a data-link-type="dfn" href="#iso-2022-jp-decoder-escape-start" id="ref-for-iso-2022-jp-decoder-escape-start">escape start</a> and return <a data-link-type="dfn" href="#continue" id="ref-for-continue①②">continue</a>. </p> <dt>0x00 to 0x7F, excluding 0x0E, 0x0F, and 0x1B <dd> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-output-flag" id="ref-for-iso-2022-jp-output-flag">ISO-2022-JP output</a> to false and return a code point whose value is <var>byte</var>. </p> <dt><a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream④⑤">end-of-queue</a> <dd> <p>Return <a data-link-type="dfn" href="#finished" id="ref-for-finished①⑤">finished</a>. </p> <dt>Otherwise <dd> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-output-flag" id="ref-for-iso-2022-jp-output-flag①">ISO-2022-JP output</a> to false and return <a data-link-type="dfn" href="#error" id="ref-for-error③⑥">error</a>. </p> </dl> <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="ISO-2022-JP decoder Roman" data-noexport id="iso-2022-jp-decoder-roman">Roman</dfn> <dd> <p>Based on <var>byte</var>: </p> <dl class="switch"> <dt>0x1B <dd> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-decoder-state" id="ref-for-iso-2022-jp-decoder-state②">ISO-2022-JP decoder state</a> to <a data-link-type="dfn" href="#iso-2022-jp-decoder-escape-start" id="ref-for-iso-2022-jp-decoder-escape-start①">escape start</a> and return <a data-link-type="dfn" href="#continue" id="ref-for-continue①③">continue</a>. </p> <dt>0x5C <dd> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-output-flag" id="ref-for-iso-2022-jp-output-flag②">ISO-2022-JP output</a> to false and return code point U+00A5. </p> <dt>0x7E <dd> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-output-flag" id="ref-for-iso-2022-jp-output-flag③">ISO-2022-JP output</a> to false and return code point U+203E. </p> <dt>0x00 to 0x7F, excluding 0x0E, 0x0F, 0x1B, 0x5C, and 0x7E <dd> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-output-flag" id="ref-for-iso-2022-jp-output-flag④">ISO-2022-JP output</a> to false and return a code point whose value is <var>byte</var>. </p> <dt><a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream④⑥">end-of-queue</a> <dd> <p>Return <a data-link-type="dfn" href="#finished" id="ref-for-finished①⑥">finished</a>. </p> <dt>Otherwise <dd> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-output-flag" id="ref-for-iso-2022-jp-output-flag⑤">ISO-2022-JP output</a> to false and return <a data-link-type="dfn" href="#error" id="ref-for-error③⑦">error</a>. </p> </dl> <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="ISO-2022-JP decoder katakana" data-noexport id="iso-2022-jp-decoder-katakana">katakana</dfn> <dd> <p>Based on <var>byte</var>: </p> <dl class="switch"> <dt>0x1B <dd> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-decoder-state" id="ref-for-iso-2022-jp-decoder-state③">ISO-2022-JP decoder state</a> to <a data-link-type="dfn" href="#iso-2022-jp-decoder-escape-start" id="ref-for-iso-2022-jp-decoder-escape-start②">escape start</a> and return <a data-link-type="dfn" href="#continue" id="ref-for-continue①④">continue</a>. </p> <dt>0x21 to 0x5F <dd> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-output-flag" id="ref-for-iso-2022-jp-output-flag⑥">ISO-2022-JP output</a> to false and return a code point whose value is 0xFF61 − 0x21 + <var>byte</var>. </p> <dt><a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream④⑦">end-of-queue</a> <dd> <p>Return <a data-link-type="dfn" href="#finished" id="ref-for-finished①⑦">finished</a>. </p> <dt>Otherwise <dd> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-output-flag" id="ref-for-iso-2022-jp-output-flag⑦">ISO-2022-JP output</a> to false and return <a data-link-type="dfn" href="#error" id="ref-for-error③⑧">error</a>. </p> </dl> <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="ISO-2022-JP decoder lead byte" data-noexport id="iso-2022-jp-decoder-lead-byte">Lead byte</dfn> <dd> <p>Based on <var>byte</var>: </p> <dl class="switch"> <dt>0x1B <dd> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-decoder-state" id="ref-for-iso-2022-jp-decoder-state④">ISO-2022-JP decoder state</a> to <a data-link-type="dfn" href="#iso-2022-jp-decoder-escape-start" id="ref-for-iso-2022-jp-decoder-escape-start③">escape start</a> and return <a data-link-type="dfn" href="#continue" id="ref-for-continue①⑤">continue</a>. </p> <dt>0x21 to 0x7E <dd> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-output-flag" id="ref-for-iso-2022-jp-output-flag⑧">ISO-2022-JP output</a> to false, <a data-link-type="dfn" href="#iso-2022-jp-lead" id="ref-for-iso-2022-jp-lead">ISO-2022-JP lead</a> to <var>byte</var>, <a data-link-type="dfn" href="#iso-2022-jp-decoder-state" id="ref-for-iso-2022-jp-decoder-state⑤">ISO-2022-JP decoder state</a> to <a data-link-type="dfn" href="#iso-2022-jp-decoder-trail-byte" id="ref-for-iso-2022-jp-decoder-trail-byte">trail byte</a>, and return <a data-link-type="dfn" href="#continue" id="ref-for-continue①⑥">continue</a>. </p> <dt><a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream④⑧">end-of-queue</a> <dd> <p>Return <a data-link-type="dfn" href="#finished" id="ref-for-finished①⑧">finished</a>. </p> <dt>Otherwise <dd> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-output-flag" id="ref-for-iso-2022-jp-output-flag⑨">ISO-2022-JP output</a> to false and return <a data-link-type="dfn" href="#error" id="ref-for-error③⑨">error</a>. </p> </dl> <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="ISO-2022-JP decoder trail byte" data-noexport id="iso-2022-jp-decoder-trail-byte">Trail byte</dfn> <dd> <p>Based on <var>byte</var>: </p> <dl class="switch"> <dt>0x1B <dd> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-decoder-state" id="ref-for-iso-2022-jp-decoder-state⑥">ISO-2022-JP decoder state</a> to <a data-link-type="dfn" href="#iso-2022-jp-decoder-escape-start" id="ref-for-iso-2022-jp-decoder-escape-start④">escape start</a> and return <a data-link-type="dfn" href="#error" id="ref-for-error④⓪">error</a>. </p> <dt>0x21 to 0x7E <dd> <ol> <li> <p>Set the <a data-link-type="dfn" href="#iso-2022-jp-decoder-state" id="ref-for-iso-2022-jp-decoder-state⑦">ISO-2022-JP decoder state</a> to <a data-link-type="dfn" href="#iso-2022-jp-decoder-lead-byte" id="ref-for-iso-2022-jp-decoder-lead-byte">lead byte</a>. </p> <li> <p>Let <var>pointer</var> be (<a data-link-type="dfn" href="#iso-2022-jp-lead" id="ref-for-iso-2022-jp-lead①">ISO-2022-JP lead</a> − 0x21) × 94 + <var>byte</var> − 0x21. </p> <li> <p>Let <var>code point</var> be the <a data-link-type="dfn" href="#index-code-point" id="ref-for-index-code-point④">index code point</a> for <var>pointer</var> in <a data-link-type="dfn" href="#index-jis0208" id="ref-for-index-jis0208⑥">index jis0208</a>. </p> <li> <p>If <var>code point</var> is null, return <a data-link-type="dfn" href="#error" id="ref-for-error④①">error</a>. </p> <li> <p>Return a code point whose value is <var>code point</var>. </p> </ol> <dt><a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream④⑨">end-of-queue</a> <dd> <p>Set the <a data-link-type="dfn" href="#iso-2022-jp-decoder-state" id="ref-for-iso-2022-jp-decoder-state⑧">ISO-2022-JP decoder state</a> to <a data-link-type="dfn" href="#iso-2022-jp-decoder-lead-byte" id="ref-for-iso-2022-jp-decoder-lead-byte①">lead byte</a> and return <a data-link-type="dfn" href="#error" id="ref-for-error④②">error</a>. </p> <dt>Otherwise <dd> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-decoder-state" id="ref-for-iso-2022-jp-decoder-state⑨">ISO-2022-JP decoder state</a> to <a data-link-type="dfn" href="#iso-2022-jp-decoder-lead-byte" id="ref-for-iso-2022-jp-decoder-lead-byte②">lead byte</a> and return <a data-link-type="dfn" href="#error" id="ref-for-error④③">error</a>. </p> </dl> <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="ISO-2022-JP decoder escape start" data-noexport id="iso-2022-jp-decoder-escape-start">Escape start</dfn> <dd> <ol> <li> <p>If <var>byte</var> is either 0x24 or 0x28, set <a data-link-type="dfn" href="#iso-2022-jp-lead" id="ref-for-iso-2022-jp-lead②">ISO-2022-JP lead</a> to <var>byte</var>, <a data-link-type="dfn" href="#iso-2022-jp-decoder-state" id="ref-for-iso-2022-jp-decoder-state①⓪">ISO-2022-JP decoder state</a> to <a data-link-type="dfn" href="#iso-2022-jp-decoder-escape" id="ref-for-iso-2022-jp-decoder-escape">escape</a>, and return <a data-link-type="dfn" href="#continue" id="ref-for-continue①⑦">continue</a>. </p> <li> <p>If <var>byte</var> is not <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑤⓪">end-of-queue</a>, then <a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend⑨">restore</a> <var>byte</var> to <var>ioQueue</var>. </p> <li> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-output-flag" id="ref-for-iso-2022-jp-output-flag①⓪">ISO-2022-JP output</a> to false, <a data-link-type="dfn" href="#iso-2022-jp-decoder-state" id="ref-for-iso-2022-jp-decoder-state①①">ISO-2022-JP decoder state</a> to <a data-link-type="dfn" href="#iso-2022-jp-decoder-output-state" id="ref-for-iso-2022-jp-decoder-output-state">ISO-2022-JP decoder output state</a>, and return <a data-link-type="dfn" href="#error" id="ref-for-error④④">error</a>. </p> </ol> <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="ISO-2022-JP decoder escape" data-noexport id="iso-2022-jp-decoder-escape">Escape</dfn> <dd> <ol> <li> <p>Let <var>lead</var> be <a data-link-type="dfn" href="#iso-2022-jp-lead" id="ref-for-iso-2022-jp-lead③">ISO-2022-JP lead</a> and set <a data-link-type="dfn" href="#iso-2022-jp-lead" id="ref-for-iso-2022-jp-lead④">ISO-2022-JP lead</a> to 0x00. </p> <li> <p>Let <var>state</var> be null. </p> <li> <p>If <var>lead</var> is 0x28 and <var>byte</var> is 0x42, set <var>state</var> to <a data-link-type="dfn" href="#iso-2022-jp-decoder-ascii" id="ref-for-iso-2022-jp-decoder-ascii②">ASCII</a>. </p> <li> <p>If <var>lead</var> is 0x28 and <var>byte</var> is 0x4A, set <var>state</var> to <a data-link-type="dfn" href="#iso-2022-jp-decoder-roman" id="ref-for-iso-2022-jp-decoder-roman①">Roman</a>. </p> <li> <p>If <var>lead</var> is 0x28 and <var>byte</var> is 0x49, set <var>state</var> to <a data-link-type="dfn" href="#iso-2022-jp-decoder-katakana" id="ref-for-iso-2022-jp-decoder-katakana">katakana</a>. </p> <li> <p>If <var>lead</var> is 0x24 and <var>byte</var> is either 0x40 or 0x42, set <var>state</var> to <a data-link-type="dfn" href="#iso-2022-jp-decoder-lead-byte" id="ref-for-iso-2022-jp-decoder-lead-byte③">lead byte</a>. </p> <li> <p>If <var>state</var> is non-null, then: </p> <ol> <li> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-decoder-state" id="ref-for-iso-2022-jp-decoder-state①②">ISO-2022-JP decoder state</a> and <a data-link-type="dfn" href="#iso-2022-jp-decoder-output-state" id="ref-for-iso-2022-jp-decoder-output-state①">ISO-2022-JP decoder output state</a> to <var>state</var>. </p> <li> <p>Let <var>output</var> be the value of <a data-link-type="dfn" href="#iso-2022-jp-output-flag" id="ref-for-iso-2022-jp-output-flag①①">ISO-2022-JP output</a>. </p> <li> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-output-flag" id="ref-for-iso-2022-jp-output-flag①②">ISO-2022-JP output</a> to true. </p> <li> <p>Return <a data-link-type="dfn" href="#continue" id="ref-for-continue①⑧">continue</a>, if <var>output</var> is false, and <a data-link-type="dfn" href="#error" id="ref-for-error④⑤">error</a> otherwise. </p> </ol> <li> <p>If <var>byte</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑤①">end-of-queue</a>, then <a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend①⓪">restore</a> <var>lead</var> to <var>ioQueue</var>; otherwise, <a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend①①">restore</a> « <var>lead</var>, <var>byte</var> » to <var>ioQueue</var>. </p> <li> <p>Set <a data-link-type="dfn" href="#iso-2022-jp-output-flag" id="ref-for-iso-2022-jp-output-flag①③">ISO-2022-JP output</a> to false, <a data-link-type="dfn" href="#iso-2022-jp-decoder-state" id="ref-for-iso-2022-jp-decoder-state①③">ISO-2022-JP decoder state</a> to <a data-link-type="dfn" href="#iso-2022-jp-decoder-output-state" id="ref-for-iso-2022-jp-decoder-output-state②">ISO-2022-JP decoder output state</a> and return <a data-link-type="dfn" href="#error" id="ref-for-error④⑥">error</a>. </p> </ol> </dl> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="12.2.2" data-lt="ISO-2022-JP encoder" id="iso-2022-jp-encoder"><span class="secno">12.2.2. </span><span class="content">ISO-2022-JP encoder</span><a class="self-link" href="#iso-2022-jp-encoder" id="ref-for-iso-2022-jp-encoder⑥"></a></h4> <div class="note no-backref" role="note"> <p>The <a data-link-type="dfn" href="#iso-2022-jp-encoder" id="ref-for-iso-2022-jp-encoder④">ISO-2022-JP encoder</a> is the only <a data-link-type="dfn" href="#encoder" id="ref-for-encoder②⑧">encoder</a> for which the concatenation of multiple outputs can result in an <a data-link-type="dfn" href="#error" id="ref-for-error④⑦">error</a> when run through the corresponding <a data-link-type="dfn" href="#decoder" id="ref-for-decoder③③">decoder</a>. </p> <p class="example" id="example-iso-2022-jp-encoder-oddity"><a class="self-link" href="#example-iso-2022-jp-encoder-oddity"></a>Encoding U+00A5 gives 0x1B 0x28 0x4A 0x5C 0x1B 0x28 0x42. Doing that twice, concatenating the results, and then decoding yields U+00A5 U+FFFD U+00A5. </p> </div> <p><a data-link-type="dfn" href="#iso-2022-jp" id="ref-for-iso-2022-jp④">ISO-2022-JP</a>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder②⑨">encoder</a> has an associated <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="iso-2022-jp-encoder-state">ISO-2022-JP encoder state</dfn> which is <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="ISO-2022-JP encoder ASCII" data-noexport id="iso-2022-jp-encoder-ascii">ASCII</dfn>, <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="ISO-2022-JP encoder Roman" data-noexport id="iso-2022-jp-encoder-roman">Roman</dfn>, or <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="ISO-2022-JP encoder jis0208" data-noexport id="iso-2022-jp-encoder-jis0208">jis0208</dfn> (initially <a data-link-type="dfn" href="#iso-2022-jp-encoder-ascii" id="ref-for-iso-2022-jp-encoder-ascii">ASCII</a>). </p> <p><a data-link-type="dfn" href="#iso-2022-jp" id="ref-for-iso-2022-jp⑤">ISO-2022-JP</a>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder③⓪">encoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler①⑤">handler</a>, given <var>ioQueue</var> and <var>code point</var>, runs these steps: </p> <ol> <li> <p>If <var>code point</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑤②">end-of-queue</a> and <a data-link-type="dfn" href="#iso-2022-jp-encoder-state" id="ref-for-iso-2022-jp-encoder-state">ISO-2022-JP encoder state</a> is not <a data-link-type="dfn" href="#iso-2022-jp-encoder-ascii" id="ref-for-iso-2022-jp-encoder-ascii①">ASCII</a>, set <a data-link-type="dfn" href="#iso-2022-jp-encoder-state" id="ref-for-iso-2022-jp-encoder-state①">ISO-2022-JP encoder state</a> to <a data-link-type="dfn" href="#iso-2022-jp-encoder-ascii" id="ref-for-iso-2022-jp-encoder-ascii②">ASCII</a>, and return three bytes 0x1B 0x28 0x42. </p> <li> <p>If <var>code point</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑤③">end-of-queue</a> and <a data-link-type="dfn" href="#iso-2022-jp-encoder-state" id="ref-for-iso-2022-jp-encoder-state②">ISO-2022-JP encoder state</a> is <a data-link-type="dfn" href="#iso-2022-jp-encoder-ascii" id="ref-for-iso-2022-jp-encoder-ascii③">ASCII</a>, return <a data-link-type="dfn" href="#finished" id="ref-for-finished①⑨">finished</a>. </p> <li> <p>If <a data-link-type="dfn" href="#iso-2022-jp-encoder-state" id="ref-for-iso-2022-jp-encoder-state③">ISO-2022-JP encoder state</a> is <a data-link-type="dfn" href="#iso-2022-jp-encoder-ascii" id="ref-for-iso-2022-jp-encoder-ascii④">ASCII</a> or <a data-link-type="dfn" href="#iso-2022-jp-encoder-roman" id="ref-for-iso-2022-jp-encoder-roman">Roman</a>, and <var>code point</var> is U+000E, U+000F, or U+001B, return <a data-link-type="dfn" href="#error" id="ref-for-error④⑧">error</a> with U+FFFD. </p> <p class="note" role="note">This returns U+FFFD rather than <var>code point</var> to prevent attacks. </p> <li> <p>If <a data-link-type="dfn" href="#iso-2022-jp-encoder-state" id="ref-for-iso-2022-jp-encoder-state④">ISO-2022-JP encoder state</a> is <a data-link-type="dfn" href="#iso-2022-jp-encoder-ascii" id="ref-for-iso-2022-jp-encoder-ascii⑤">ASCII</a> and <var>code point</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-code-point" id="ref-for-ascii-code-point⑥">ASCII code point</a>, return a byte whose value is <var>code point</var>. </p> <li> <p>If <a data-link-type="dfn" href="#iso-2022-jp-encoder-state" id="ref-for-iso-2022-jp-encoder-state⑤">ISO-2022-JP encoder state</a> is <a data-link-type="dfn" href="#iso-2022-jp-encoder-roman" id="ref-for-iso-2022-jp-encoder-roman①">Roman</a> and <var>code point</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-code-point" id="ref-for-ascii-code-point⑦">ASCII code point</a>, excluding U+005C and U+007E, or is U+00A5 or U+203E, then: </p> <ol> <li> <p>If <var>code point</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-code-point" id="ref-for-ascii-code-point⑧">ASCII code point</a>, return a byte whose value is <var>code point</var>. </p> <li> <p>If <var>code point</var> is U+00A5, return byte 0x5C. </p> <li> <p>If <var>code point</var> is U+203E, return byte 0x7E. </p> </ol> <li> <p>If <var>code point</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-code-point" id="ref-for-ascii-code-point⑨">ASCII code point</a>, and <a data-link-type="dfn" href="#iso-2022-jp-encoder-state" id="ref-for-iso-2022-jp-encoder-state⑥">ISO-2022-JP encoder state</a> is not <a data-link-type="dfn" href="#iso-2022-jp-encoder-ascii" id="ref-for-iso-2022-jp-encoder-ascii⑥">ASCII</a>, <a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend①②">restore</a> <var>code point</var> to <var>ioQueue</var>, set <a data-link-type="dfn" href="#iso-2022-jp-encoder-state" id="ref-for-iso-2022-jp-encoder-state⑦">ISO-2022-JP encoder state</a> to <a data-link-type="dfn" href="#iso-2022-jp-encoder-ascii" id="ref-for-iso-2022-jp-encoder-ascii⑦">ASCII</a>, and return three bytes 0x1B 0x28 0x42. </p> <li> <p>If <var>code point</var> is either U+00A5 or U+203E, and <a data-link-type="dfn" href="#iso-2022-jp-encoder-state" id="ref-for-iso-2022-jp-encoder-state⑧">ISO-2022-JP encoder state</a> is not <a data-link-type="dfn" href="#iso-2022-jp-encoder-roman" id="ref-for-iso-2022-jp-encoder-roman②">Roman</a>, <a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend①③">restore</a> <var>code point</var> to <var>ioQueue</var>, set <a data-link-type="dfn" href="#iso-2022-jp-encoder-state" id="ref-for-iso-2022-jp-encoder-state⑨">ISO-2022-JP encoder state</a> to <a data-link-type="dfn" href="#iso-2022-jp-encoder-roman" id="ref-for-iso-2022-jp-encoder-roman③">Roman</a>, and return three bytes 0x1B 0x28 0x4A. </p> <li> <p>If <var>code point</var> is U+2212, set it to U+FF0D. </p> <li> <p>If <var>code point</var> is in the range U+FF61 to U+FF9F, inclusive, set it to the <a data-link-type="dfn" href="#index-code-point" id="ref-for-index-code-point⑤">index code point</a> for <var>code point</var> − 0xFF61 in <a data-link-type="dfn" href="#index-iso-2022-jp-katakana" id="ref-for-index-iso-2022-jp-katakana②">index ISO-2022-JP katakana</a>. </p> <li> <p>Let <var>pointer</var> be the <a data-link-type="dfn" href="#index-pointer" id="ref-for-index-pointer⑥">index pointer</a> for <var>code point</var> in <a data-link-type="dfn" href="#index-jis0208" id="ref-for-index-jis0208⑦">index jis0208</a>. </p> <p class="note" role="note">If <var>pointer</var> is non-null, it is less than 8836 due to the nature of <a data-link-type="dfn" href="#index-jis0208" id="ref-for-index-jis0208⑧">index jis0208</a> and the <a data-link-type="dfn" href="#index-pointer" id="ref-for-index-pointer⑦">index pointer</a> operation. </p> <li> <p>If <var>pointer</var> is null, then: </p> <ol> <li> <p>If <a data-link-type="dfn" href="#iso-2022-jp-encoder-state" id="ref-for-iso-2022-jp-encoder-state①⓪">ISO-2022-JP encoder state</a> is <a data-link-type="dfn" href="#iso-2022-jp-encoder-jis0208" id="ref-for-iso-2022-jp-encoder-jis0208">jis0208</a>, then <a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend①④">restore</a> <var>code point</var> to <var>ioQueue</var>, set <a data-link-type="dfn" href="#iso-2022-jp-encoder-state" id="ref-for-iso-2022-jp-encoder-state①①">ISO-2022-JP encoder state</a> to <a data-link-type="dfn" href="#iso-2022-jp-encoder-ascii" id="ref-for-iso-2022-jp-encoder-ascii⑧">ASCII</a>, and return three bytes 0x1B 0x28 0x42. </p> <li> <p>Return <a data-link-type="dfn" href="#error" id="ref-for-error④⑨">error</a> with <var>code point</var>. </p> </ol> <li> <p>If <a data-link-type="dfn" href="#iso-2022-jp-encoder-state" id="ref-for-iso-2022-jp-encoder-state①②">ISO-2022-JP encoder state</a> is not <a data-link-type="dfn" href="#iso-2022-jp-encoder-jis0208" id="ref-for-iso-2022-jp-encoder-jis0208①">jis0208</a>, <a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend①⑤">restore</a> <var>code point</var> to <var>ioQueue</var>, set <a data-link-type="dfn" href="#iso-2022-jp-encoder-state" id="ref-for-iso-2022-jp-encoder-state①③">ISO-2022-JP encoder state</a> to <a data-link-type="dfn" href="#iso-2022-jp-encoder-jis0208" id="ref-for-iso-2022-jp-encoder-jis0208②">jis0208</a>, and return three bytes 0x1B 0x24 0x42. </p> <li> <p>Let <var>lead</var> be <var>pointer</var> / 94 + 0x21. </p> <li> <p>Let <var>trail</var> be <var>pointer</var> % 94 + 0x21. </p> <li> <p>Return two bytes whose values are <var>lead</var> and <var>trail</var>. </p> </ol> <h3 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="12.3" data-lt="Shift_JIS" id="shift_jis"><span class="secno">12.3. </span><span class="content">Shift_JIS</span><a class="self-link" href="#shift_jis" id="ref-for-shift_jis⑥"></a></h3> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="12.3.1" data-lt="Shift_JIS decoder" id="shift_jis-decoder"><span class="secno">12.3.1. </span><span class="content">Shift_JIS decoder</span><a class="self-link" href="#shift_jis-decoder" id="ref-for-shift_jis-decoder"></a></h4> <p><a data-link-type="dfn" href="#shift_jis" id="ref-for-shift_jis③">Shift_JIS</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder③④">decoder</a> has an associated <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="shift_jis-lead">Shift_JIS lead</dfn> (initially 0x00). </p> <p><a data-link-type="dfn" href="#shift_jis" id="ref-for-shift_jis④">Shift_JIS</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder③⑤">decoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler①⑥">handler</a>, given <var>ioQueue</var> and <var>byte</var>, runs these steps: </p> <ol> <li> <p>If <var>byte</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑤④">end-of-queue</a> and <a data-link-type="dfn" href="#shift_jis-lead" id="ref-for-shift_jis-lead">Shift_JIS lead</a> is not 0x00, set <a data-link-type="dfn" href="#shift_jis-lead" id="ref-for-shift_jis-lead①">Shift_JIS lead</a> to 0x00 and return <a data-link-type="dfn" href="#error" id="ref-for-error⑤⓪">error</a>. </p> <li> <p>If <var>byte</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑤⑤">end-of-queue</a> and <a data-link-type="dfn" href="#shift_jis-lead" id="ref-for-shift_jis-lead②">Shift_JIS lead</a> is 0x00, return <a data-link-type="dfn" href="#finished" id="ref-for-finished②⓪">finished</a>. </p> <li> <p>If <a data-link-type="dfn" href="#shift_jis-lead" id="ref-for-shift_jis-lead③">Shift_JIS lead</a> is not 0x00, let <var>lead</var> be <a data-link-type="dfn" href="#shift_jis-lead" id="ref-for-shift_jis-lead④">Shift_JIS lead</a>, let <var>pointer</var> be null, set <a data-link-type="dfn" href="#shift_jis-lead" id="ref-for-shift_jis-lead⑤">Shift_JIS lead</a> to 0x00, and then: </p> <ol> <li> <p>Let <var>offset</var> be 0x40 if <var>byte</var> is less than 0x7F, otherwise 0x41. </p> <li> <p>Let <var>lead offset</var> be 0x81 if <var>lead</var> is less than 0xA0, otherwise 0xC1. </p> <li> <p>If <var>byte</var> is in the range 0x40 to 0x7E, inclusive, or 0x80 to 0xFC, inclusive, set <var>pointer</var> to (<var>lead</var> − <var>lead offset</var>) × 188 + <var>byte</var> − <var>offset</var>. </p> <li> <p>If <var>pointer</var> is in the range 8836 to 10715, inclusive, return a code point whose value is 0xE000 − 8836 + <var>pointer</var>. </p> <p class="note" role="note">This is interoperable legacy from Windows known as EUDC. </p> <li> <p>Let <var>code point</var> be null if <var>pointer</var> is null, otherwise the <a data-link-type="dfn" href="#index-code-point" id="ref-for-index-code-point⑥">index code point</a> for <var>pointer</var> in <a data-link-type="dfn" href="#index-jis0208" id="ref-for-index-jis0208⑨">index jis0208</a>. </p> <li> <p>If <var>code point</var> is non-null, return a code point whose value is <var>code point</var>. </p> <li> <p>If <var>byte</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-byte" id="ref-for-ascii-byte⑧">ASCII byte</a>, <a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend①⑥">restore</a> <var>byte</var> to <var>ioQueue</var>. </p> <li> <p>Return <a data-link-type="dfn" href="#error" id="ref-for-error⑤①">error</a>. </p> </ol> <li> <p>If <var>byte</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-byte" id="ref-for-ascii-byte⑨">ASCII byte</a> or 0x80, return a code point whose value is <var>byte</var>. </p> <li> <p>If <var>byte</var> is in the range 0xA1 to 0xDF, inclusive, return a code point whose value is 0xFF61 − 0xA1 + <var>byte</var>. </p> <li> <p>If <var>byte</var> is in the range 0x81 to 0x9F, inclusive, or 0xE0 to 0xFC, inclusive, set <a data-link-type="dfn" href="#shift_jis-lead" id="ref-for-shift_jis-lead⑥">Shift_JIS lead</a> to <var>byte</var> and return <a data-link-type="dfn" href="#continue" id="ref-for-continue①⑨">continue</a>. </p> <li> <p>Return <a data-link-type="dfn" href="#error" id="ref-for-error⑤②">error</a>. </p> </ol> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="12.3.2" data-lt="Shift_JIS encoder" id="shift_jis-encoder"><span class="secno">12.3.2. </span><span class="content">Shift_JIS encoder</span><a class="self-link" href="#shift_jis-encoder" id="ref-for-shift_jis-encoder"></a></h4> <p><a data-link-type="dfn" href="#shift_jis" id="ref-for-shift_jis⑤">Shift_JIS</a>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder③①">encoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler①⑦">handler</a>, given <var>ioQueue</var> and <var>code point</var>, runs these steps: </p> <ol> <li> <p>If <var>code point</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑤⑥">end-of-queue</a>, return <a data-link-type="dfn" href="#finished" id="ref-for-finished②①">finished</a>. </p> <li> <p>If <var>code point</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-code-point" id="ref-for-ascii-code-point①⓪">ASCII code point</a> or U+0080, return a byte whose value is <var>code point</var>. </p> <li> <p>If <var>code point</var> is U+00A5, return byte 0x5C. </p> <li> <p>If <var>code point</var> is U+203E, return byte 0x7E. </p> <li> <p>If <var>code point</var> is in the range U+FF61 to U+FF9F, inclusive, return a byte whose value is <var>code point</var> − 0xFF61 + 0xA1. </p> <li> <p>If <var>code point</var> is U+2212, set it to U+FF0D. </p> <li> <p>Let <var>pointer</var> be the <a data-link-type="dfn" href="#index-shift_jis-pointer" id="ref-for-index-shift_jis-pointer">index Shift_JIS pointer</a> for <var>code point</var>. </p> <li> <p>If <var>pointer</var> is null, return <a data-link-type="dfn" href="#error" id="ref-for-error⑤③">error</a> with <var>code point</var>. </p> <li> <p>Let <var>lead</var> be <var>pointer</var> / 188. </p> <li> <p>Let <var>lead offset</var> be 0x81 if <var>lead</var> is less than 0x1F, otherwise 0xC1. </p> <li> <p>Let <var>trail</var> be <var>pointer</var> % 188. </p> <li> <p>Let <var>offset</var> be 0x40 if <var>trail</var> is less than 0x3F, otherwise 0x41. </p> <li> <p>Return two bytes whose values are <var>lead</var> + <var>lead offset</var> and <var>trail</var> + <var>offset</var>. </p> </ol> <h2 class="heading settled" data-level="13" id="legacy-multi-byte-korean-encodings"><span class="secno">13. </span><span class="content">Legacy multi-byte Korean encodings</span><a class="self-link" href="#legacy-multi-byte-korean-encodings"></a></h2> <h3 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="13.1" data-lt="EUC-KR" id="euc-kr"><span class="secno">13.1. </span><span class="content">EUC-KR</span><a class="self-link" href="#euc-kr" id="ref-for-euc-kr④"></a></h3> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="13.1.1" data-lt="EUC-KR decoder" id="euc-kr-decoder"><span class="secno">13.1.1. </span><span class="content">EUC-KR decoder</span><a class="self-link" href="#euc-kr-decoder" id="ref-for-euc-kr-decoder"></a></h4> <p><a data-link-type="dfn" href="#euc-kr" id="ref-for-euc-kr①">EUC-KR</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder③⑥">decoder</a> has an associated <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="euc-kr-lead">EUC-KR lead</dfn> (initially 0x00). </p> <p><a data-link-type="dfn" href="#euc-kr" id="ref-for-euc-kr②">EUC-KR</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder③⑦">decoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler①⑧">handler</a>, given <var>ioQueue</var> and <var>byte</var>, runs these steps: </p> <ol> <li> <p>If <var>byte</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑤⑦">end-of-queue</a> and <a data-link-type="dfn" href="#euc-kr-lead" id="ref-for-euc-kr-lead">EUC-KR lead</a> is not 0x00, set <a data-link-type="dfn" href="#euc-kr-lead" id="ref-for-euc-kr-lead①">EUC-KR lead</a> to 0x00 and return <a data-link-type="dfn" href="#error" id="ref-for-error⑤④">error</a>. </p> <li> <p>If <var>byte</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑤⑧">end-of-queue</a> and <a data-link-type="dfn" href="#euc-kr-lead" id="ref-for-euc-kr-lead②">EUC-KR lead</a> is 0x00, return <a data-link-type="dfn" href="#finished" id="ref-for-finished②②">finished</a>. </p> <li> <p>If <a data-link-type="dfn" href="#euc-kr-lead" id="ref-for-euc-kr-lead③">EUC-KR lead</a> is not 0x00, let <var>lead</var> be <a data-link-type="dfn" href="#euc-kr-lead" id="ref-for-euc-kr-lead④">EUC-KR lead</a>, let <var>pointer</var> be null, set <a data-link-type="dfn" href="#euc-kr-lead" id="ref-for-euc-kr-lead⑤">EUC-KR lead</a> to 0x00, and then: </p> <ol> <li> <p>If <var>byte</var> is in the range 0x41 to 0xFE, inclusive, set <var>pointer</var> to (<var>lead</var> − 0x81) × 190 + (<var>byte</var> − 0x41). </p> <li> <p>Let <var>code point</var> be null if <var>pointer</var> is null, otherwise the <a data-link-type="dfn" href="#index-code-point" id="ref-for-index-code-point⑦">index code point</a> for <var>pointer</var> in <a data-link-type="dfn" href="#index-euc-kr" id="ref-for-index-euc-kr">index EUC-KR</a>. </p> <li> <p>If <var>code point</var> is non-null, return a code point whose value is <var>code point</var>. </p> <li> <p>If <var>byte</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-byte" id="ref-for-ascii-byte①⓪">ASCII byte</a>, <a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend①⑦">restore</a> <var>byte</var> to <var>ioQueue</var>. </p> <li> <p>Return <a data-link-type="dfn" href="#error" id="ref-for-error⑤⑤">error</a>. </p> </ol> <li> <p>If <var>byte</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-byte" id="ref-for-ascii-byte①①">ASCII byte</a>, return a code point whose value is <var>byte</var>. </p> <li> <p>If <var>byte</var> is in the range 0x81 to 0xFE, inclusive, set <a data-link-type="dfn" href="#euc-kr-lead" id="ref-for-euc-kr-lead⑥">EUC-KR lead</a> to <var>byte</var> and return <a data-link-type="dfn" href="#continue" id="ref-for-continue②⓪">continue</a>. </p> <li> <p>Return <a data-link-type="dfn" href="#error" id="ref-for-error⑤⑥">error</a>. </p> </ol> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="13.1.2" data-lt="EUC-KR encoder" id="euc-kr-encoder"><span class="secno">13.1.2. </span><span class="content">EUC-KR encoder</span><a class="self-link" href="#euc-kr-encoder" id="ref-for-euc-kr-encoder"></a></h4> <p><a data-link-type="dfn" href="#euc-kr" id="ref-for-euc-kr③">EUC-KR</a>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder③②">encoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler①⑨">handler</a>, given <var>ioQueue</var> and <var>code point</var>, runs these steps: </p> <ol> <li> <p>If <var>code point</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑤⑨">end-of-queue</a>, return <a data-link-type="dfn" href="#finished" id="ref-for-finished②③">finished</a>. </p> <li> <p>If <var>code point</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-code-point" id="ref-for-ascii-code-point①①">ASCII code point</a>, return a byte whose value is <var>code point</var>. </p> <li> <p>Let <var>pointer</var> be the <a data-link-type="dfn" href="#index-pointer" id="ref-for-index-pointer⑧">index pointer</a> for <var>code point</var> in <a data-link-type="dfn" href="#index-euc-kr" id="ref-for-index-euc-kr①">index EUC-KR</a>. </p> <li> <p>If <var>pointer</var> is null, return <a data-link-type="dfn" href="#error" id="ref-for-error⑤⑦">error</a> with <var>code point</var>. </p> <li> <p>Let <var>lead</var> be <var>pointer</var> / 190 + 0x81. </p> <li> <p>Let <var>trail</var> be <var>pointer</var> % 190 + 0x41. </p> <li> <p>Return two bytes whose values are <var>lead</var> and <var>trail</var>. </p> </ol> <h2 class="heading settled" data-level="14" id="legacy-miscellaneous-encodings"><span class="secno">14. </span><span class="content">Legacy miscellaneous encodings</span><a class="self-link" href="#legacy-miscellaneous-encodings"></a></h2> <h3 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="14.1" data-lt="replacement" id="replacement"><span class="secno">14.1. </span><span class="content">replacement</span><a class="self-link" href="#replacement" id="ref-for-replacement①②"></a></h3> <p class="note" role="note">The <a data-link-type="dfn" href="#replacement" id="ref-for-replacement⑨">replacement</a> <a data-link-type="dfn" href="#encoding" id="ref-for-encoding②⑨">encoding</a> exists to prevent certain attacks that abuse a mismatch between <a data-link-type="dfn" href="#encoding" id="ref-for-encoding③⓪">encodings</a> supported on the server and the client. </p> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="14.1.1" data-lt="replacement decoder" id="replacement-decoder"><span class="secno">14.1.1. </span><span class="content">replacement decoder</span><a class="self-link" href="#replacement-decoder" id="ref-for-replacement-decoder"></a></h4> <p><a data-link-type="dfn" href="#replacement" id="ref-for-replacement①⓪">replacement</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder③⑧">decoder</a> has an associated <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="replacement-error-returned-flag">replacement error returned</dfn> (initially false). </p> <p><a data-link-type="dfn" href="#replacement" id="ref-for-replacement①①">replacement</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder③⑨">decoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler②⓪">handler</a>, given <var>ioQueue</var> and <var>byte</var>, runs these steps: </p> <ol> <li> <p>If <var>byte</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑥⓪">end-of-queue</a>, return <a data-link-type="dfn" href="#finished" id="ref-for-finished②④">finished</a>. </p> <li> <p>If <a data-link-type="dfn" href="#replacement-error-returned-flag" id="ref-for-replacement-error-returned-flag">replacement error returned</a> is false, set <a data-link-type="dfn" href="#replacement-error-returned-flag" id="ref-for-replacement-error-returned-flag①">replacement error returned</a> to true and return <a data-link-type="dfn" href="#error" id="ref-for-error⑤⑧">error</a>. </p> <li> <p>Return <a data-link-type="dfn" href="#finished" id="ref-for-finished②⑤">finished</a>. </p> </ol> <h3 class="heading settled" data-level="14.2" id="common-infrastructure-for-utf-16be-and-utf-16le"><span class="secno">14.2. </span><span class="content">Common infrastructure for <a data-link-type="dfn" href="#utf-16be-le" id="ref-for-utf-16be-le⑤">UTF-16BE/LE</a></span><a class="self-link" href="#common-infrastructure-for-utf-16be-and-utf-16le"></a></h3> <p><dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="utf-16be-le">UTF-16BE/LE</dfn> is <a data-link-type="dfn" href="#utf-16be" id="ref-for-utf-16be④">UTF-16BE</a> or <a data-link-type="dfn" href="#utf-16le" id="ref-for-utf-16le④">UTF-16LE</a>. </p> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="14.2.1" data-lt="shared UTF-16 decoder" id="shared-utf-16-decoder"><span class="secno">14.2.1. </span><span class="content">shared UTF-16 decoder</span><a class="self-link" href="#shared-utf-16-decoder" id="ref-for-shared-utf-16-decoder"></a></h4> <p class="note" role="note">A byte order mark has priority over a label as it has been found to be more accurate in deployed content. Therefore it is not part of the <a data-link-type="dfn" href="#shared-utf-16-decoder" id="ref-for-shared-utf-16-decoder⑤">shared UTF-16 decoder</a> algorithm, but rather the <a data-link-type="dfn" href="#decode" id="ref-for-decode⑥">decode</a> algorithm. </p> <p><a data-link-type="dfn" href="#shared-utf-16-decoder" id="ref-for-shared-utf-16-decoder①">shared UTF-16 decoder</a> has an associated <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="utf-16-lead-byte">UTF-16 lead byte</dfn> and <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="utf-16-lead-surrogate">UTF-16 leading surrogate</dfn> (both initially null), and <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="utf-16be-decoder-flag">is UTF-16BE decoder</dfn> (initially false). </p> <p><a data-link-type="dfn" href="#shared-utf-16-decoder" id="ref-for-shared-utf-16-decoder②">shared UTF-16 decoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler②①">handler</a>, given <var>ioQueue</var> and <var>byte</var>, runs these steps: </p> <ol> <li> <p>If <var>byte</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑥①">end-of-queue</a> and either <a data-link-type="dfn" href="#utf-16-lead-byte" id="ref-for-utf-16-lead-byte">UTF-16 lead byte</a> or <a data-link-type="dfn" href="#utf-16-lead-surrogate" id="ref-for-utf-16-lead-surrogate">UTF-16 leading surrogate</a> is non-null, set <a data-link-type="dfn" href="#utf-16-lead-byte" id="ref-for-utf-16-lead-byte①">UTF-16 lead byte</a> and <a data-link-type="dfn" href="#utf-16-lead-surrogate" id="ref-for-utf-16-lead-surrogate①">UTF-16 leading surrogate</a> to null, and return <a data-link-type="dfn" href="#error" id="ref-for-error⑤⑨">error</a>. </p> <li> <p>If <var>byte</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑥②">end-of-queue</a> and <a data-link-type="dfn" href="#utf-16-lead-byte" id="ref-for-utf-16-lead-byte②">UTF-16 lead byte</a> and <a data-link-type="dfn" href="#utf-16-lead-surrogate" id="ref-for-utf-16-lead-surrogate②">UTF-16 leading surrogate</a> are null, return <a data-link-type="dfn" href="#finished" id="ref-for-finished②⑥">finished</a>. </p> <li> <p>If <a data-link-type="dfn" href="#utf-16-lead-byte" id="ref-for-utf-16-lead-byte③">UTF-16 lead byte</a> is null, set <a data-link-type="dfn" href="#utf-16-lead-byte" id="ref-for-utf-16-lead-byte④">UTF-16 lead byte</a> to <var>byte</var> and return <a data-link-type="dfn" href="#continue" id="ref-for-continue②①">continue</a>. </p> <li> <p>Let <var>code unit</var> be the result of: </p> <dl class="switch"> <dt><a data-link-type="dfn" href="#utf-16be-decoder-flag" id="ref-for-utf-16be-decoder-flag">is UTF-16BE decoder</a> is true <dd> <p>(<a data-link-type="dfn" href="#utf-16-lead-byte" id="ref-for-utf-16-lead-byte⑤">UTF-16 lead byte</a> &lt;&lt; 8) + <var>byte</var>. </p> <dt><a data-link-type="dfn" href="#utf-16be-decoder-flag" id="ref-for-utf-16be-decoder-flag①">is UTF-16BE decoder</a> is false <dd> <p>(<var>byte</var> &lt;&lt; 8) + <a data-link-type="dfn" href="#utf-16-lead-byte" id="ref-for-utf-16-lead-byte⑥">UTF-16 lead byte</a>. </p> </dl> <p>Then set <a data-link-type="dfn" href="#utf-16-lead-byte" id="ref-for-utf-16-lead-byte⑦">UTF-16 lead byte</a> to null. </p> <li> <p>If <a data-link-type="dfn" href="#utf-16-lead-surrogate" id="ref-for-utf-16-lead-surrogate③">UTF-16 leading surrogate</a> is non-null: </p> <ol> <li> <p>Let <var>leadingSurrogate</var> be <a data-link-type="dfn" href="#utf-16-lead-surrogate" id="ref-for-utf-16-lead-surrogate④">UTF-16 leading surrogate</a>. </p> <li> <p>Set <a data-link-type="dfn" href="#utf-16-lead-surrogate" id="ref-for-utf-16-lead-surrogate⑤">UTF-16 leading surrogate</a> to null. </p> <li> <p>If <var>code unit</var> is a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#trailing-surrogate" id="ref-for-trailing-surrogate③">trailing surrogate</a>, then return a <a data-link-type="dfn" href="#scalar-value-from-surrogates" id="ref-for-scalar-value-from-surrogates①">scalar value from surrogates</a> given <var>leadingSurrogate</var> and <var>code unit</var>. </p> <li> <p>Let <var>byte1</var> be <var>code unit</var> >> 8. </p> <li> <p>Let <var>byte2</var> be <var>code unit</var> &amp; 0x00FF. </p> <li> <p>Let <var>bytes</var> be a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list⑦">list</a> of two bytes whose values are <var>byte1</var> and <var>byte2</var>, if <a data-link-type="dfn" href="#utf-16be-decoder-flag" id="ref-for-utf-16be-decoder-flag②">is UTF-16BE decoder</a> is true; otherwise <var>byte2</var> and <var>byte1</var>. </p> <li> <p><a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend①⑧">Restore</a> <var>bytes</var> to <var>ioQueue</var> and return <a data-link-type="dfn" href="#error" id="ref-for-error⑥⓪">error</a>. </p> </ol> <li> <p>If <var>code unit</var> is a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#leading-surrogate" id="ref-for-leading-surrogate③">leading surrogate</a>, then set <a data-link-type="dfn" href="#utf-16-lead-surrogate" id="ref-for-utf-16-lead-surrogate⑥">UTF-16 leading surrogate</a> to <var>code unit</var> and return <a data-link-type="dfn" href="#continue" id="ref-for-continue②②">continue</a>. </p> <li> <p>If <var>code unit</var> is a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#trailing-surrogate" id="ref-for-trailing-surrogate④">trailing surrogate</a>, then return <a data-link-type="dfn" href="#error" id="ref-for-error⑥①">error</a>. </p> <li> <p>Return code point <var>code unit</var>. </p> </ol> <h3 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="14.3" data-lt="UTF-16BE" id="utf-16be"><span class="secno">14.3. </span><span class="content">UTF-16BE</span><a class="self-link" href="#utf-16be" id="ref-for-utf-16be⑥"></a></h3> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="14.3.1" data-lt="UTF-16BE decoder" id="utf-16be-decoder"><span class="secno">14.3.1. </span><span class="content">UTF-16BE decoder</span><a class="self-link" href="#utf-16be-decoder" id="ref-for-utf-16be-decoder"></a></h4> <p><a data-link-type="dfn" href="#utf-16be" id="ref-for-utf-16be⑤">UTF-16BE</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder④⓪">decoder</a> is <a data-link-type="dfn" href="#shared-utf-16-decoder" id="ref-for-shared-utf-16-decoder③">shared UTF-16 decoder</a> with its <a data-link-type="dfn" href="#utf-16be-decoder-flag" id="ref-for-utf-16be-decoder-flag③">is UTF-16BE decoder</a> set to true. </p> <h3 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="14.4" data-lt="UTF-16LE" id="utf-16le"><span class="secno">14.4. </span><span class="content">UTF-16LE</span><a class="self-link" href="#utf-16le" id="ref-for-utf-16le⑦"></a></h3> <p class="note" role="note">"<code>utf-16</code>" is a <a data-link-type="dfn" href="#label" id="ref-for-label⑧">label</a> for <a data-link-type="dfn" href="#utf-16le" id="ref-for-utf-16le⑤">UTF-16LE</a> to deal with deployed content. </p> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="14.4.1" data-lt="UTF-16LE decoder" id="utf-16le-decoder"><span class="secno">14.4.1. </span><span class="content">UTF-16LE decoder</span><a class="self-link" href="#utf-16le-decoder" id="ref-for-utf-16le-decoder"></a></h4> <p><a data-link-type="dfn" href="#utf-16le" id="ref-for-utf-16le⑥">UTF-16LE</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder④①">decoder</a> is <a data-link-type="dfn" href="#shared-utf-16-decoder" id="ref-for-shared-utf-16-decoder④">shared UTF-16 decoder</a>. </p> <h3 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="14.5" data-lt="x-user-defined" id="x-user-defined"><span class="secno">14.5. </span><span class="content">x-user-defined</span><a class="self-link" href="#x-user-defined" id="ref-for-x-user-defined③"></a></h3> <p class="note" role="note">While technically this is a <a data-link-type="dfn" href="#single-byte-encoding" id="ref-for-single-byte-encoding⑥">single-byte encoding</a>, it is defined separately as it can be implemented algorithmically. </p> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="14.5.1" data-lt="x-user-defined decoder" id="x-user-defined-decoder"><span class="secno">14.5.1. </span><span class="content">x-user-defined decoder</span><a class="self-link" href="#x-user-defined-decoder" id="ref-for-x-user-defined-decoder"></a></h4> <p><a data-link-type="dfn" href="#x-user-defined" id="ref-for-x-user-defined①">x-user-defined</a>’s <a data-link-type="dfn" href="#decoder" id="ref-for-decoder④②">decoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler②②">handler</a>, given <var>ioQueue</var> and <var>byte</var>, runs these steps: </p> <ol> <li> <p>If <var>byte</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑥③">end-of-queue</a>, return <a data-link-type="dfn" href="#finished" id="ref-for-finished②⑦">finished</a>. </p> <li> <p>If <var>byte</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-byte" id="ref-for-ascii-byte①②">ASCII byte</a>, return a code point whose value is <var>byte</var>. </p> <li> <p>Return a code point whose value is 0xF780 + <var>byte</var> − 0x80. </p> </ol> <h4 class="heading settled dfn-paneled" data-dfn-type="dfn" data-export data-level="14.5.2" data-lt="x-user-defined encoder" id="x-user-defined-encoder"><span class="secno">14.5.2. </span><span class="content">x-user-defined encoder</span><a class="self-link" href="#x-user-defined-encoder" id="ref-for-x-user-defined-encoder"></a></h4> <p><a data-link-type="dfn" href="#x-user-defined" id="ref-for-x-user-defined②">x-user-defined</a>’s <a data-link-type="dfn" href="#encoder" id="ref-for-encoder③③">encoder</a>’s <a data-link-type="dfn" href="#handler" id="ref-for-handler②③">handler</a>, given <var>ioQueue</var> and <var>code point</var>, runs these steps: </p> <ol> <li> <p>If <var>code point</var> is <a data-link-type="dfn" href="#end-of-stream" id="ref-for-end-of-stream⑥④">end-of-queue</a>, return <a data-link-type="dfn" href="#finished" id="ref-for-finished②⑧">finished</a>. </p> <li> <p>If <var>code point</var> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-code-point" id="ref-for-ascii-code-point①②">ASCII code point</a>, return a byte whose value is <var>code point</var>. </p> <li> <p>If <var>code point</var> is in the range U+F780 to U+F7FF, inclusive, return a byte whose value is <var>code point</var> − 0xF780 + 0x80. </p> <li> <p>Return <a data-link-type="dfn" href="#error" id="ref-for-error⑥②">error</a> with <var>code point</var>. </p> </ol> <h2 class="heading settled" data-level="15" id="browser-ui"><span class="secno">15. </span><span class="content">Browser UI</span><a class="self-link" href="#browser-ui"></a></h2> <p>Browsers are encouraged to not enable overriding the encoding of a resource. If such a feature is nonetheless present, browsers should not offer <a data-link-type="dfn" href="#utf-16be-le" id="ref-for-utf-16be-le⑥">UTF-16BE/LE</a> as an option, due to the aforementioned security issues. Browsers should also disable this feature if the resource was decoded using <a data-link-type="dfn" href="#utf-16be-le" id="ref-for-utf-16be-le⑦">UTF-16BE/LE</a>. </p> <h2 class="no-num heading settled" id="implementation-considerations"><span class="content">Implementation considerations</span><a class="self-link" href="#implementation-considerations"></a></h2> <p>Instead of supporting <a data-link-type="dfn" href="#concept-stream" id="ref-for-concept-stream③⑤">I/O queues</a> with arbitrary <a data-link-type="dfn" href="#concept-stream-prepend" id="ref-for-concept-stream-prepend①⑨">restore</a>, the <a data-link-type="dfn" href="#decoder" id="ref-for-decoder④③">decoders</a> for <a data-link-type="dfn" href="#encoding" id="ref-for-encoding③①">encodings</a> in this standard could be implemented with: </p> <ol> <li> <p>The ability to unread the current byte. </p> <li> <p>A single-byte buffer for <a data-link-type="dfn" href="#gb18030" id="ref-for-gb18030⑧">gb18030</a> (an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-byte" id="ref-for-ascii-byte①③">ASCII byte</a>) and <a data-link-type="dfn" href="#iso-2022-jp" id="ref-for-iso-2022-jp⑥">ISO-2022-JP</a> (0x24 or 0x28). </p> <p class="example" id="example-gb18030-implementation-strategy"><a class="self-link" href="#example-gb18030-implementation-strategy"></a>For <a data-link-type="dfn" href="#gb18030" id="ref-for-gb18030⑨">gb18030</a> when hitting a bogus byte while <a data-link-type="dfn" href="#gb18030-third" id="ref-for-gb18030-third⑨">gb18030 third</a> is not 0x00, <a data-link-type="dfn" href="#gb18030-second" id="ref-for-gb18030-second①①">gb18030 second</a> could be moved into the single-byte buffer to be returned next, and <a data-link-type="dfn" href="#gb18030-third" id="ref-for-gb18030-third①⓪">gb18030 third</a> would be the new <a data-link-type="dfn" href="#gb18030-first" id="ref-for-gb18030-first①①">gb18030 first</a>, checked for not being 0x00 after the single-byte buffer was returned and emptied. This is possible as the range for the first and third byte in <a data-link-type="dfn" href="#gb18030" id="ref-for-gb18030①⓪">gb18030</a> is identical. </p> </ol> <p>The <a data-link-type="dfn" href="#iso-2022-jp-encoder" id="ref-for-iso-2022-jp-encoder⑤">ISO-2022-JP encoder</a> needs <a data-link-type="dfn" href="#iso-2022-jp-encoder-state" id="ref-for-iso-2022-jp-encoder-state①④">ISO-2022-JP encoder state</a> as additional state, but other than that, none of the <a data-link-type="dfn" href="#encoder" id="ref-for-encoder③④">encoders</a> for <a data-link-type="dfn" href="#encoding" id="ref-for-encoding③②">encodings</a> in this standard require additional state or buffers. </p> <h2 class="no-num heading settled" id="acknowledgments"><span class="content">Acknowledgments</span><a class="self-link" href="#acknowledgments"></a></h2> <p>There have been a lot of people that have helped make encodings more interoperable over the years and thereby furthered the goals of this standard. Likewise many people have helped making this standard what it is today. </p> <p>With that, many thanks to Adam Rice, Alan Chaney, Alexander Shtuchkin, Allen Wirfs-Brock, Andreu Botella, Aneesh Agrawal, Arkadiusz Michalski, Asmus Freytag, Ben Noordhuis, Bnaya Peretz, Boris Zbarsky, Bruno Haible, Cameron McCormack, Charles McCathieNeville, Christopher Foo, CodifierNL, David Carlisle, Domenic Denicola, Dominique Hazaël-Massieux, Doug Ewell, Erik van der Poel, 譚永鋒 (Frank Yung-Fong Tang), Glenn Maynard, Gordon P. Hemsley, Henri Sivonen, Ian Hickson, J. King, James Graham, Jeffrey Yasskin, John Tamplin, Joshua Bell, 村井純 (Jun Murai), 신정식 (Jungshik Shin), Jxck, 강 성훈 (Kang Seonghoon), 川幡太一 (Kawabata Taichi), Ken Lunde, Ken Whistler, Kenneth Russell, 田村健人 (Kent Tamura), Leif Halvard Silli, Luke Wagner, Maciej Hirsz, Makoto Kato, Mark Callow, Mark Crispin, Mark Davis, Martin Dürst, Masatoshi Kimura, Mattias Buelens, Ms2ger, Nigel Megitt, Nigel Tao, Norbert Lindenberg, Øistein E. Andersen, Peter Krefting, Philip Jägenstedt, Philip Taylor, Richard Ishida, Robbert Broersma, Robert Mustacchi, Ryan Dahl, Sam Sneddon, Shawn Steele, Simon Montagu, Simon Pieters, Simon Sapin, Stephen Checkoway, 寺田健 (Takeshi Terada), Vyacheslav Matva, Wolf Lammen, and 成瀬ゆい (Yui Naruse) for being awesome. </p> <p>This standard is written by <a href="https://annevankesteren.nl/" lang="nl">Anne van Kesteren</a> (<a href="https://www.apple.com/">Apple</a>, <a href="mailto:annevk@annevk.nl">annevk@annevk.nl</a>). The <a href="#api">API</a> chapter was initially written by Joshua Bell (<a href="https://www.google.com/">Google</a>). </p> <h2 class="no-num heading settled" id="ipr"><span class="content">Intellectual property rights</span><a class="self-link" href="#ipr"></a></h2> <p>Copyright © WHATWG (Apple, Google, Mozilla, Microsoft). This work is licensed under a <a href="https://creativecommons.org/licenses/by/4.0/" rel="license">Creative Commons Attribution 4.0 International License</a>. To the extent portions of it are incorporated into source code, such portions in the source code are licensed under the <a href="https://opensource.org/licenses/BSD-3-Clause" rel="license">BSD 3-Clause License</a> instead.</p> <p>This is the Living Standard. Those interested in the patent-review version should view the <a href="/review-drafts/2023-06/">Living Standard Review Draft</a>.</p> </main> <script> "use strict"; if ("serviceWorker" in navigator) { navigator.serviceWorker.register("/service-worker.js"); } </script> <h2 class="no-num no-ref heading settled" id="section-index"><span class="content">Index</span><a class="self-link" href="#section-index"></a></h2> <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3> <ul class="index"> <li><a href="#big5">Big5</a><span>, in § 11</span> <li><a href="#big5-decoder">Big5 decoder</a><span>, in § 11.1</span> <li><a href="#big5-encoder">Big5 encoder</a><span>, in § 11.1.1</span> <li><a href="#big5-lead">Big5 lead</a><span>, in § 11.1.1</span> <li><a href="#textdecoder-bom-seen-flag">BOM seen</a><span>, in § 7.1</span> <li><a href="#bom-sniff">BOM sniff</a><span>, in § 6.1</span> <li> constructor() <ul> <li><a href="#dom-textdecoder">constructor for TextDecoder</a><span>, in § 7.2</span> <li><a href="#dom-textdecoderstream">constructor for TextDecoderStream</a><span>, in § 7.5</span> <li><a href="#dom-textencoder">constructor for TextEncoder</a><span>, in § 7.4</span> <li><a href="#dom-textencoderstream">constructor for TextEncoderStream</a><span>, in § 7.6</span> </ul> <li> constructor(label) <ul> <li><a href="#dom-textdecoder">constructor for TextDecoder</a><span>, in § 7.2</span> <li><a href="#dom-textdecoderstream">constructor for TextDecoderStream</a><span>, in § 7.5</span> </ul> <li> constructor(label, options) <ul> <li><a href="#dom-textdecoder">constructor for TextDecoder</a><span>, in § 7.2</span> <li><a href="#dom-textdecoderstream">constructor for TextDecoderStream</a><span>, in § 7.5</span> </ul> <li><a href="#continue">continue</a><span>, in § 4.1</span> <li> convert <ul> <li><a href="#from-i-o-queue-convert">dfn for from I/O queue</a><span>, in § 3</span> <li><a href="#to-i-o-queue-convert">dfn for to I/O queue</a><span>, in § 3</span> </ul> <li><a href="#convert-code-unit-to-scalar-value">convert code unit to scalar value</a><span>, in § 7.6</span> <li><a href="#decode">decode</a><span>, in § 6.1</span> <li><a href="#dom-textdecoder-decode">decode()</a><span>, in § 7.2</span> <li><a href="#decode-and-enqueue-a-chunk">decode and enqueue a chunk</a><span>, in § 7.5</span> <li><a href="#dom-textdecoder-decode">decode(input)</a><span>, in § 7.2</span> <li><a href="#dom-textdecoder-decode">decode(input, options)</a><span>, in § 7.2</span> <li> decoder <ul> <li><a href="#decoder">definition of</a><span>, in § 4.1</span> <li><a href="#textdecodercommon-decoder">dfn for TextDecoderCommon</a><span>, in § 7.1</span> </ul> <li><a href="#textdecoder-do-not-flush-flag">do not flush</a><span>, in § 7.2</span> <li><a href="#encode">encode</a><span>, in § 6.1</span> <li><a href="#dom-textencoder-encode">encode()</a><span>, in § 7.4</span> <li><a href="#encode-and-enqueue-a-chunk">encode and enqueue a chunk</a><span>, in § 7.6</span> <li><a href="#encode-and-flush">encode and flush</a><span>, in § 7.6</span> <li><a href="#dom-textencoder-encode">encode(input)</a><span>, in § 7.4</span> <li><a href="#dom-textencoder-encodeinto">encodeInto(source, destination)</a><span>, in § 7.4</span> <li><a href="#encode-or-fail">encode or fail</a><span>, in § 6.1</span> <li> encoder <ul> <li><a href="#encoder">definition of</a><span>, in § 4.1</span> <li><a href="#textencoderstream-encoder">dfn for TextEncoderStream</a><span>, in § 7.6</span> </ul> <li> encoding <ul> <li><a href="#dom-textdecoder-encoding">attribute for TextDecoderCommon</a><span>, in § 7.1</span> <li><a href="#dom-textencoder-encoding">attribute for TextEncoderCommon</a><span>, in § 7.3</span> <li><a href="#encoding">definition of</a><span>, in § 4</span> <li><a href="#textdecoder-encoding">dfn for TextDecoderCommon</a><span>, in § 7.1</span> </ul> <li><a href="#end-of-stream">End-of-queue</a><span>, in § 3</span> <li><a href="#error">error</a><span>, in § 4.1</span> <li> error mode <ul> <li><a href="#error-mode">definition of</a><span>, in § 4.1</span> <li><a href="#textdecoder-error-mode">dfn for TextDecoderCommon</a><span>, in § 7.1</span> </ul> <li><a href="#euc-jp">EUC-JP</a><span>, in § 12</span> <li><a href="#euc-jp-decoder">EUC-JP decoder</a><span>, in § 12.1</span> <li><a href="#euc-jp-encoder">EUC-JP encoder</a><span>, in § 12.1.1</span> <li><a href="#euc-jp-jis0212-flag">EUC-JP jis0212</a><span>, in § 12.1.1</span> <li><a href="#euc-jp-lead">EUC-JP lead</a><span>, in § 12.1.1</span> <li><a href="#euc-kr">EUC-KR</a><span>, in § 13</span> <li><a href="#euc-kr-decoder">EUC-KR decoder</a><span>, in § 13.1</span> <li><a href="#euc-kr-encoder">EUC-KR encoder</a><span>, in § 13.1.1</span> <li><a href="#euc-kr-lead">EUC-KR lead</a><span>, in § 13.1.1</span> <li> fatal <ul> <li><a href="#dom-textdecoder-fatal">attribute for TextDecoderCommon</a><span>, in § 7.1</span> <li><a href="#dom-textdecoderoptions-fatal">dict-member for TextDecoderOptions</a><span>, in § 7.2</span> </ul> <li><a href="#finished">finished</a><span>, in § 4.1</span> <li><a href="#flush-and-enqueue">flush and enqueue</a><span>, in § 7.5</span> <li><a href="#gb18030">gb18030</a><span>, in § 10.1.2</span> <li><a href="#gb18030-decoder">gb18030 decoder</a><span>, in § 10.2</span> <li><a href="#gb18030-encoder">gb18030 encoder</a><span>, in § 10.2.1</span> <li><a href="#gb18030-first">gb18030 first</a><span>, in § 10.2.1</span> <li><a href="#gb18030-second">gb18030 second</a><span>, in § 10.2.1</span> <li><a href="#gb18030-third">gb18030 third</a><span>, in § 10.2.1</span> <li><a href="#gbk">GBK</a><span>, in § 10</span> <li><a href="#gbk-decoder">GBK decoder</a><span>, in § 10.1</span> <li><a href="#gbk-encoder">GBK encoder</a><span>, in § 10.1.1</span> <li><a href="#get-an-encoder">get an encoder</a><span>, in § 6.1</span> <li><a href="#concept-encoding-get">get an encoding</a><span>, in § 4.2</span> <li><a href="#get-an-output-encoding">get an output encoding</a><span>, in § 4.3</span> <li><a href="#get-an-encoder">getting an encoder</a><span>, in § 6.1</span> <li><a href="#concept-encoding-get">getting an encoding</a><span>, in § 4.2</span> <li><a href="#handler">handler</a><span>, in § 4.1</span> <li><a href="#ibm866">IBM866</a><span>, in § 9</span> <li><a href="#textdecoder-ignore-bom-flag">ignore BOM</a><span>, in § 7.1</span> <li> ignoreBOM <ul> <li><a href="#dom-textdecoder-ignorebom">attribute for TextDecoderCommon</a><span>, in § 7.1</span> <li><a href="#dom-textdecoderoptions-ignorebom">dict-member for TextDecoderOptions</a><span>, in § 7.2</span> </ul> <li><a href="#index">index</a><span>, in § 5</span> <li><a href="#index-big5">index Big5</a><span>, in § 5</span> <li><a href="#index-big5-pointer">index Big5 pointer</a><span>, in § 5</span> <li><a href="#index-code-point">index code point</a><span>, in § 5</span> <li><a href="#index-euc-kr">index EUC-KR</a><span>, in § 5</span> <li><a href="#index-gb18030">index gb18030</a><span>, in § 5</span> <li><a href="#index-gb18030-ranges">index gb18030 ranges</a><span>, in § 5</span> <li><a href="#index-gb18030-ranges-code-point">index gb18030 ranges code point</a><span>, in § 5</span> <li><a href="#index-gb18030-ranges-pointer">index gb18030 ranges pointer</a><span>, in § 5</span> <li><a href="#index-iso-2022-jp-katakana">index ISO-2022-JP katakana</a><span>, in § 5</span> <li><a href="#index-jis0208">index jis0208</a><span>, in § 5</span> <li><a href="#index-jis0212">index jis0212</a><span>, in § 5</span> <li><a href="#index-pointer">index pointer</a><span>, in § 5</span> <li><a href="#index-shift_jis-pointer">index Shift_JIS pointer</a><span>, in § 5</span> <li><a href="#index-single-byte">Index single-byte</a><span>, in § 9</span> <li> I/O queue <ul> <li><a href="#concept-stream">definition of</a><span>, in § 3</span> <li><a href="#textdecodercommon-i-o-queue">dfn for TextDecoderCommon</a><span>, in § 7.1</span> </ul> <li><a href="#gbk-flag">is GBK</a><span>, in § 10.2.2</span> <li><a href="#iso-2022-jp">ISO-2022-JP</a><span>, in § 12.1.2</span> <li><a href="#iso-2022-jp-decoder">ISO-2022-JP decoder</a><span>, in § 12.2</span> <li><a href="#iso-2022-jp-decoder-ascii">ISO-2022-JP decoder ASCII</a><span>, in § 12.2.1</span> <li><a href="#iso-2022-jp-decoder-escape">ISO-2022-JP decoder escape</a><span>, in § 12.2.1</span> <li><a href="#iso-2022-jp-decoder-escape-start">ISO-2022-JP decoder escape start</a><span>, in § 12.2.1</span> <li><a href="#iso-2022-jp-decoder-katakana">ISO-2022-JP decoder katakana</a><span>, in § 12.2.1</span> <li><a href="#iso-2022-jp-decoder-lead-byte">ISO-2022-JP decoder lead byte</a><span>, in § 12.2.1</span> <li><a href="#iso-2022-jp-decoder-output-state">ISO-2022-JP decoder output state</a><span>, in § 12.2.1</span> <li><a href="#iso-2022-jp-decoder-roman">ISO-2022-JP decoder Roman</a><span>, in § 12.2.1</span> <li><a href="#iso-2022-jp-decoder-state">ISO-2022-JP decoder state</a><span>, in § 12.2.1</span> <li><a href="#iso-2022-jp-decoder-trail-byte">ISO-2022-JP decoder trail byte</a><span>, in § 12.2.1</span> <li><a href="#iso-2022-jp-encoder">ISO-2022-JP encoder</a><span>, in § 12.2.1</span> <li><a href="#iso-2022-jp-encoder-ascii">ISO-2022-JP encoder ASCII</a><span>, in § 12.2.2</span> <li><a href="#iso-2022-jp-encoder-jis0208">ISO-2022-JP encoder jis0208</a><span>, in § 12.2.2</span> <li><a href="#iso-2022-jp-encoder-roman">ISO-2022-JP encoder Roman</a><span>, in § 12.2.2</span> <li><a href="#iso-2022-jp-encoder-state">ISO-2022-JP encoder state</a><span>, in § 12.2.2</span> <li><a href="#iso-2022-jp-lead">ISO-2022-JP lead</a><span>, in § 12.2.1</span> <li><a href="#iso-2022-jp-output-flag">ISO-2022-JP output</a><span>, in § 12.2.1</span> <li><a href="#iso-8859-10">ISO-8859-10</a><span>, in § 9</span> <li><a href="#iso-8859-13">ISO-8859-13</a><span>, in § 9</span> <li><a href="#iso-8859-14">ISO-8859-14</a><span>, in § 9</span> <li><a href="#iso-8859-15">ISO-8859-15</a><span>, in § 9</span> <li><a href="#iso-8859-16">ISO-8859-16</a><span>, in § 9</span> <li><a href="#iso-8859-2">ISO-8859-2</a><span>, in § 9</span> <li><a href="#iso-8859-3">ISO-8859-3</a><span>, in § 9</span> <li><a href="#iso-8859-4">ISO-8859-4</a><span>, in § 9</span> <li><a href="#iso-8859-5">ISO-8859-5</a><span>, in § 9</span> <li><a href="#iso-8859-6">ISO-8859-6</a><span>, in § 9</span> <li><a href="#iso-8859-7">ISO-8859-7</a><span>, in § 9</span> <li><a href="#iso-8859-8">ISO-8859-8</a><span>, in § 9</span> <li><a href="#iso-8859-8-i">ISO-8859-8-I</a><span>, in § 9</span> <li><a href="#utf-16be-decoder-flag">is UTF-16BE decoder</a><span>, in § 14.2.1</span> <li><a href="#koi8-r">KOI8-R</a><span>, in § 9</span> <li><a href="#koi8-u">KOI8-U</a><span>, in § 9</span> <li><a href="#label">label</a><span>, in § 4</span> <li><a href="#textencoderstream-pending-high-surrogate">leading surrogate</a><span>, in § 7.6</span> <li><a href="#macintosh">macintosh</a><span>, in § 9</span> <li><a href="#name">name</a><span>, in § 4</span> <li><a href="#i-o-queue-peek">peek</a><span>, in § 3</span> <li><a href="#concept-encoding-process">process an item</a><span>, in § 4.1</span> <li><a href="#concept-encoding-run">process a queue</a><span>, in § 4.1</span> <li><a href="#concept-encoding-process">processing an item</a><span>, in § 4.1</span> <li><a href="#concept-encoding-run">processing a queue</a><span>, in § 4.1</span> <li><a href="#concept-stream-push">push</a><span>, in § 3</span> <li> read <ul> <li><a href="#concept-stream-read">dfn for I/O queue</a><span>, in § 3</span> <li><a href="#dom-textencoderencodeintoresult-read">dict-member for TextEncoderEncodeIntoResult</a><span>, in § 7.4</span> </ul> <li><a href="#replacement">replacement</a><span>, in § 14</span> <li><a href="#replacement-decoder">replacement decoder</a><span>, in § 14.1</span> <li><a href="#replacement-error-returned-flag">replacement error returned</a><span>, in § 14.1.1</span> <li><a href="#concept-stream-prepend">restore</a><span>, in § 3</span> <li><a href="#scalar-value-from-surrogates">scalar value from surrogates</a><span>, in § 3</span> <li><a href="#concept-td-serialize">serialize I/O queue</a><span>, in § 7.1</span> <li><a href="#shared-utf-16-decoder">shared UTF-16 decoder</a><span>, in § 14.2</span> <li><a href="#shift_jis">Shift_JIS</a><span>, in § 12.2.2</span> <li><a href="#shift_jis-decoder">Shift_JIS decoder</a><span>, in § 12.3</span> <li><a href="#shift_jis-encoder">Shift_JIS encoder</a><span>, in § 12.3.1</span> <li><a href="#shift_jis-lead">Shift_JIS lead</a><span>, in § 12.3.1</span> <li><a href="#single-byte-decoder">single-byte decoder</a><span>, in § 9</span> <li><a href="#single-byte-encoder">single-byte encoder</a><span>, in § 9.1</span> <li><a href="#single-byte-encoding">single-byte encoding</a><span>, in § 9</span> <li><a href="#dom-textdecodeoptions-stream">stream</a><span>, in § 7.2</span> <li><a href="#textdecodeoptions">TextDecodeOptions</a><span>, in § 7.2</span> <li><a href="#textdecoder">TextDecoder</a><span>, in § 7.2</span> <li><a href="#dom-textdecoder">TextDecoder()</a><span>, in § 7.2</span> <li><a href="#textdecodercommon">TextDecoderCommon</a><span>, in § 7.1</span> <li><a href="#dom-textdecoder">TextDecoder(label)</a><span>, in § 7.2</span> <li><a href="#dom-textdecoder">TextDecoder(label, options)</a><span>, in § 7.2</span> <li><a href="#textdecoderoptions">TextDecoderOptions</a><span>, in § 7.2</span> <li><a href="#textdecoderstream">TextDecoderStream</a><span>, in § 7.5</span> <li><a href="#dom-textdecoderstream">TextDecoderStream()</a><span>, in § 7.5</span> <li><a href="#dom-textdecoderstream">TextDecoderStream(label)</a><span>, in § 7.5</span> <li><a href="#dom-textdecoderstream">TextDecoderStream(label, options)</a><span>, in § 7.5</span> <li><a href="#textencoder">TextEncoder</a><span>, in § 7.4</span> <li><a href="#dom-textencoder">TextEncoder()</a><span>, in § 7.4</span> <li><a href="#textencodercommon">TextEncoderCommon</a><span>, in § 7.3</span> <li><a href="#dictdef-textencoderencodeintoresult">TextEncoderEncodeIntoResult</a><span>, in § 7.4</span> <li><a href="#textencoderstream">TextEncoderStream</a><span>, in § 7.6</span> <li><a href="#dom-textencoderstream">TextEncoderStream()</a><span>, in § 7.6</span> <li><a href="#utf-16be">UTF-16BE</a><span>, in § 14.2.1</span> <li><a href="#utf-16be-decoder">UTF-16BE decoder</a><span>, in § 14.3</span> <li><a href="#utf-16be-le">UTF-16BE/LE</a><span>, in § 14.2</span> <li><a href="#utf-16le">UTF-16LE</a><span>, in § 14.3.1</span> <li><a href="#utf-16-lead-byte">UTF-16 lead byte</a><span>, in § 14.2.1</span> <li><a href="#utf-16-lead-surrogate">UTF-16 leading surrogate</a><span>, in § 14.2.1</span> <li><a href="#utf-16le-decoder">UTF-16LE decoder</a><span>, in § 14.4</span> <li><a href="#utf-8">UTF-8</a><span>, in § 8</span> <li><a href="#utf-8-bytes-needed">UTF-8 bytes needed</a><span>, in § 8.1.1</span> <li><a href="#utf-8-bytes-seen">UTF-8 bytes seen</a><span>, in § 8.1.1</span> <li><a href="#utf-8-code-point">UTF-8 code point</a><span>, in § 8.1.1</span> <li><a href="#utf-8-decode">UTF-8 decode</a><span>, in § 6</span> <li><a href="#utf-8-decoder">UTF-8 decoder</a><span>, in § 8.1</span> <li><a href="#utf-8-decode-without-bom">UTF-8 decode without BOM</a><span>, in § 6</span> <li><a href="#utf-8-decode-without-bom-or-fail">UTF-8 decode without BOM or fail</a><span>, in § 6</span> <li><a href="#utf-8-encode">UTF-8 encode</a><span>, in § 6</span> <li><a href="#utf-8-encoder">UTF-8 encoder</a><span>, in § 8.1.1</span> <li><a href="#utf-8-lower-boundary">UTF-8 lower boundary</a><span>, in § 8.1.1</span> <li><a href="#utf-8-upper-boundary">UTF-8 upper boundary</a><span>, in § 8.1.1</span> <li><a href="#windows-1250">windows-1250</a><span>, in § 9</span> <li><a href="#windows-1251">windows-1251</a><span>, in § 9</span> <li><a href="#windows-1252">windows-1252</a><span>, in § 9</span> <li><a href="#windows-1253">windows-1253</a><span>, in § 9</span> <li><a href="#windows-1254">windows-1254</a><span>, in § 9</span> <li><a href="#windows-1255">windows-1255</a><span>, in § 9</span> <li><a href="#windows-1256">windows-1256</a><span>, in § 9</span> <li><a href="#windows-1257">windows-1257</a><span>, in § 9</span> <li><a href="#windows-1258">windows-1258</a><span>, in § 9</span> <li><a href="#windows-874">windows-874</a><span>, in § 9</span> <li><a href="#dom-textencoderencodeintoresult-written">written</a><span>, in § 7.4</span> <li><a href="#x-mac-cyrillic">x-mac-cyrillic</a><span>, in § 9</span> <li><a href="#x-user-defined">x-user-defined</a><span>, in § 14.4.1</span> <li><a href="#x-user-defined-decoder">x-user-defined decoder</a><span>, in § 14.5</span> <li><a href="#x-user-defined-encoder">x-user-defined encoder</a><span>, in § 14.5.1</span> </ul> <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3> <ul class="index"> <li> <a data-link-type="biblio">[HTML]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="c6d19e56">event loop</span> <li><span class="dfn-paneled" id="a72449dd">in parallel</span> </ul> <li> <a data-link-type="biblio">[INFRA]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="53275e46">append</span> <li><span class="dfn-paneled" id="617d690e">ascii byte</span> <li><span class="dfn-paneled" id="7f9469b5">ascii case-insensitive</span> <li><span class="dfn-paneled" id="ddc587b1">ascii code point</span> <li><span class="dfn-paneled" id="6f2dfa22">ascii lowercase</span> <li><span class="dfn-paneled" id="5fb1ed8a">ascii whitespace</span> <li><span class="dfn-paneled" id="7b0d918d">break</span> <li><span class="dfn-paneled" id="f5354b9d">byte</span> <li><span class="dfn-paneled" id="3de9e659">byte sequence</span> <li><span class="dfn-paneled" id="915aff5e">code point</span> <li><span class="dfn-paneled" id="59912c93">code unit</span> <li><span class="dfn-paneled" id="ae8def21">contain</span> <li><span class="dfn-paneled" id="f937b7b6">continue</span> <li><span class="dfn-paneled" id="a088e610">convert</span> <li><span class="dfn-paneled" id="16d07e10">for each</span> <li><span class="dfn-paneled" id="56ad2aed">insert</span> <li><span class="dfn-paneled" id="6b815fdd">is empty</span> <li><span class="dfn-paneled" id="5afbefcd">item</span> <li><span class="dfn-paneled" id="ae200f87">leading surrogate</span> <li><span class="dfn-paneled" id="649608b9">list</span> <li><span class="dfn-paneled" id="e2fc6023">prepend</span> <li><span class="dfn-paneled" id="47dfca75">queue</span> <li><span class="dfn-paneled" id="99c988d6">remove</span> <li><span class="dfn-paneled" id="ecf251b4">scalar value</span> <li><span class="dfn-paneled" id="762869d3">scalar value string</span> <li><span class="dfn-paneled" id="0204d188">size</span> <li><span class="dfn-paneled" id="904cdc91">starts with</span> <li><span class="dfn-paneled" id="0698d556">string</span> <li><span class="dfn-paneled" id="a3fb968a">surrogate</span> <li><span class="dfn-paneled" id="febebe0e">the range</span> <li><span class="dfn-paneled" id="453993b2">trailing surrogate</span> <li><span class="dfn-paneled" id="bb049306">value</span> </ul> <li> <a data-link-type="biblio">[STREAMS]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="d61c5cab">GenericTransformStream</span> <li><span class="dfn-paneled" id="59ed4e57">ReadableStream</span> <li><span class="dfn-paneled" id="47e93e3e">TransformStream</span> <li><span class="dfn-paneled" id="2d10bf58">chunk</span> <li><span class="dfn-paneled" id="593deb55">enqueue</span> <li><span class="dfn-paneled" id="3af29886">flushalgorithm</span> <li><span class="dfn-paneled" id="c1bd634e">pipeThrough(transform)</span> <li><span class="dfn-paneled" id="2fb3c1e9">readable</span> <li><span class="dfn-paneled" id="4e9534f3">readable stream</span> <li><span class="dfn-paneled" id="2a7798d8">set up</span> <li><span class="dfn-paneled" id="eade7401">transform</span> <li><span class="dfn-paneled" id="c7574ff1">transformalgorithm</span> <li><span class="dfn-paneled" id="97ba5569">writable</span> <li><span class="dfn-paneled" id="14fa5a95">writable stream</span> </ul> <li> <a data-link-type="biblio">[WEBIDL]</a> defines the following terms: <ul> <li><span class="dfn-paneled" id="b1e3ba8e">AllowShared</span> <li><span class="dfn-paneled" id="5e4b6157">AllowSharedBufferSource</span> <li><span class="dfn-paneled" id="2f8afbfe">ArrayBuffer</span> <li><span class="dfn-paneled" id="8855a9aa">DOMString</span> <li><span class="dfn-paneled" id="c807e273">NewObject</span> <li><span class="dfn-paneled" id="ec878a66">RangeError</span> <li><span class="dfn-paneled" id="82ca3efc">TypeError</span> <li><span class="dfn-paneled" id="b0d7f3c3">USVString</span> <li><span class="dfn-paneled" id="13d0450b">Uint32Array</span> <li><span class="dfn-paneled" id="95d7775a">Uint8Array</span> <li><span class="dfn-paneled" id="5372cca8">boolean</span> <li><span class="dfn-paneled" id="495737df">byte length</span> <li><span class="dfn-paneled" id="cadf5fe9">converted to an idl value</span> <li><span class="dfn-paneled" id="92d13070">get a copy of the buffer source</span> <li><span class="dfn-paneled" id="56f81a8e">new</span> <li><span class="dfn-paneled" id="df3c9a3c">startingoffset</span> <li><span class="dfn-paneled" id="4013a022">this</span> <li><span class="dfn-paneled" id="b4cfa5ce">throw</span> <li><span class="dfn-paneled" id="f14b47b8">unsigned long long</span> <li><span class="dfn-paneled" id="f3fd9d04">write</span> </ul> </ul> <h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2> <h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3> <dl> <dt id="biblio-infra">[INFRA] <dd>Anne van Kesteren; Domenic Denicola. <a href="https://infra.spec.whatwg.org/"><cite>Infra Standard</cite></a>. Living Standard. URL: <a href="https://infra.spec.whatwg.org/">https://infra.spec.whatwg.org/</a> <dt id="biblio-streams">[STREAMS] <dd>Adam Rice; et al. <a href="https://streams.spec.whatwg.org/"><cite>Streams Standard</cite></a>. Living Standard. URL: <a href="https://streams.spec.whatwg.org/">https://streams.spec.whatwg.org/</a> <dt id="biblio-unicode">[UNICODE] <dd><a href="https://www.unicode.org/versions/latest/"><cite>The Unicode Standard</cite></a>. URL: <a href="https://www.unicode.org/versions/latest/">https://www.unicode.org/versions/latest/</a> <dt id="biblio-webidl">[WEBIDL] <dd>Edgar Chen; Timothy Gu. <a href="https://webidl.spec.whatwg.org/"><cite>Web IDL Standard</cite></a>. Living Standard. URL: <a href="https://webidl.spec.whatwg.org/">https://webidl.spec.whatwg.org/</a> </dl> <h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3> <dl> <dt id="biblio-html">[HTML] <dd>Anne van Kesteren; et al. <a href="https://html.spec.whatwg.org/multipage/"><cite>HTML Standard</cite></a>. Living Standard. URL: <a href="https://html.spec.whatwg.org/multipage/">https://html.spec.whatwg.org/multipage/</a> <dt id="biblio-url">[URL] <dd>Anne van Kesteren. <a href="https://url.spec.whatwg.org/"><cite>URL Standard</cite></a>. Living Standard. URL: <a href="https://url.spec.whatwg.org/">https://url.spec.whatwg.org/</a> <dt id="biblio-xml">[XML] <dd>Tim Bray; et al. <a href="https://www.w3.org/TR/xml/"><cite>Extensible Markup Language (XML) 1.0 (Fifth Edition)</cite></a>. 26 November 2008. REC. URL: <a href="https://www.w3.org/TR/xml/">https://www.w3.org/TR/xml/</a> </dl> <h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">IDL Index</span><a class="self-link" href="#idl-index"></a></h2> <pre class="idl highlight def"><c- b>interface</c-> <c- b>mixin</c-> <a href="#textdecodercommon"><code><c- g>TextDecoderCommon</c-></code></a> { <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString"><c- b>DOMString</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="DOMString" href="#dom-textdecoder-encoding"><c- g>encoding</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean"><c- b>boolean</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="boolean" href="#dom-textdecoder-fatal"><c- g>fatal</c-></a>; <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean"><c- b>boolean</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="boolean" href="#dom-textdecoder-ignorebom"><c- g>ignoreBOM</c-></a>; }; <c- b>dictionary</c-> <a href="#textdecoderoptions"><code><c- g>TextDecoderOptions</c-></code></a> { <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean"><c- b>boolean</c-></a> <a data-default="false" data-type="boolean" href="#dom-textdecoderoptions-fatal"><code><c- g>fatal</c-></code></a> = <c- b>false</c->; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean"><c- b>boolean</c-></a> <a data-default="false" data-type="boolean" href="#dom-textdecoderoptions-ignorebom"><code><c- g>ignoreBOM</c-></code></a> = <c- b>false</c->; }; <c- b>dictionary</c-> <a href="#textdecodeoptions"><code><c- g>TextDecodeOptions</c-></code></a> { <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-boolean"><c- b>boolean</c-></a> <a data-default="false" data-type="boolean" href="#dom-textdecodeoptions-stream"><code><c- g>stream</c-></code></a> = <c- b>false</c->; }; [Exposed=*] <c- b>interface</c-> <a href="#textdecoder"><code><c- g>TextDecoder</c-></code></a> { <a class="idl-code" data-link-type="constructor" href="#dom-textdecoder"><c- g>constructor</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString"><c- b>DOMString</c-></a> <a href="#dom-textdecoder-textdecoder-label-options-label"><code><c- g>label</c-></code></a> = "utf-8", <c- b>optional</c-> <a data-link-type="idl-name" href="#textdecoderoptions"><c- n>TextDecoderOptions</c-></a> <a href="#dom-textdecoder-textdecoder-label-options-options"><code><c- g>options</c-></code></a> = {}); <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-USVString"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="method" href="#dom-textdecoder-decode"><c- g>decode</c-></a>(<c- b>optional</c-> <a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#AllowSharedBufferSource"><c- n>AllowSharedBufferSource</c-></a> <a href="#dom-textdecoder-decode-input-options-input"><code><c- g>input</c-></code></a>, <c- b>optional</c-> <a data-link-type="idl-name" href="#textdecodeoptions"><c- n>TextDecodeOptions</c-></a> <a href="#dom-textdecoder-decode-input-options-options"><code><c- g>options</c-></code></a> = {}); }; <a data-link-type="idl-name" href="#textdecoder"><c- n>TextDecoder</c-></a> <c- b>includes</c-> <a data-link-type="idl-name" href="#textdecodercommon"><c- n>TextDecoderCommon</c-></a>; <c- b>interface</c-> <c- b>mixin</c-> <a href="#textencodercommon"><code><c- g>TextEncoderCommon</c-></code></a> { <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString"><c- b>DOMString</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="DOMString" href="#dom-textencoder-encoding"><c- g>encoding</c-></a>; }; <c- b>dictionary</c-> <a href="#dictdef-textencoderencodeintoresult"><code><c- g>TextEncoderEncodeIntoResult</c-></code></a> { <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-long-long"><c- b>unsigned</c-> <c- b>long</c-> <c- b>long</c-></a> <a data-type="unsigned long long" href="#dom-textencoderencodeintoresult-read"><code><c- g>read</c-></code></a>; <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-unsigned-long-long"><c- b>unsigned</c-> <c- b>long</c-> <c- b>long</c-></a> <a data-type="unsigned long long" href="#dom-textencoderencodeintoresult-written"><code><c- g>written</c-></code></a>; }; [Exposed=*] <c- b>interface</c-> <a href="#textencoder"><code><c- g>TextEncoder</c-></code></a> { <a class="idl-code" data-link-type="constructor" href="#dom-textencoder"><c- g>constructor</c-></a>(); [<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#NewObject"><c- g>NewObject</c-></a>] <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-Uint8Array"><c- b>Uint8Array</c-></a> <a class="idl-code" data-link-type="method" href="#dom-textencoder-encode"><c- g>encode</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-USVString"><c- b>USVString</c-></a> <a href="#dom-textencoder-encode-input-input"><code><c- g>input</c-></code></a> = ""); <a data-link-type="idl-name" href="#dictdef-textencoderencodeintoresult"><c- n>TextEncoderEncodeIntoResult</c-></a> <a class="idl-code" data-link-type="method" href="#dom-textencoder-encodeinto"><c- g>encodeInto</c-></a>(<a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-USVString"><c- b>USVString</c-></a> <a href="#dom-textencoder-encodeinto-source-destination-source"><code><c- g>source</c-></code></a>, [<a class="idl-code" data-link-type="extended-attribute" href="https://webidl.spec.whatwg.org/#AllowShared"><c- g>AllowShared</c-></a>] <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-Uint8Array"><c- b>Uint8Array</c-></a> <a href="#dom-textencoder-encodeinto-source-destination-destination"><code><c- g>destination</c-></code></a>); }; <a data-link-type="idl-name" href="#textencoder"><c- n>TextEncoder</c-></a> <c- b>includes</c-> <a data-link-type="idl-name" href="#textencodercommon"><c- n>TextEncoderCommon</c-></a>; [Exposed=*] <c- b>interface</c-> <a href="#textdecoderstream"><code><c- g>TextDecoderStream</c-></code></a> { <a class="idl-code" data-link-type="constructor" href="#dom-textdecoderstream"><c- g>constructor</c-></a>(<c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://webidl.spec.whatwg.org/#idl-DOMString"><c- b>DOMString</c-></a> <a href="#dom-textdecoderstream-textdecoderstream-label-options-label"><code><c- g>label</c-></code></a> = "utf-8", <c- b>optional</c-> <a data-link-type="idl-name" href="#textdecoderoptions"><c- n>TextDecoderOptions</c-></a> <a href="#dom-textdecoderstream-textdecoderstream-label-options-options"><code><c- g>options</c-></code></a> = {}); }; <a data-link-type="idl-name" href="#textdecoderstream"><c- n>TextDecoderStream</c-></a> <c- b>includes</c-> <a data-link-type="idl-name" href="#textdecodercommon"><c- n>TextDecoderCommon</c-></a>; <a data-link-type="idl-name" href="#textdecoderstream"><c- n>TextDecoderStream</c-></a> <c- b>includes</c-> <a data-link-type="idl-name" href="https://streams.spec.whatwg.org/#generictransformstream"><c- n>GenericTransformStream</c-></a>; [Exposed=*] <c- b>interface</c-> <a href="#textencoderstream"><code><c- g>TextEncoderStream</c-></code></a> { <a class="idl-code" data-link-type="constructor" href="#dom-textencoderstream"><c- g>constructor</c-></a>(); }; <a data-link-type="idl-name" href="#textencoderstream"><c- n>TextEncoderStream</c-></a> <c- b>includes</c-> <a data-link-type="idl-name" href="#textencodercommon"><c- n>TextEncoderCommon</c-></a>; <a data-link-type="idl-name" href="#textencoderstream"><c- n>TextEncoderStream</c-></a> <c- b>includes</c-> <a data-link-type="idl-name" href="https://streams.spec.whatwg.org/#generictransformstream"><c- n>GenericTransformStream</c-></a>; </pre> <details class="mdn-anno unpositioned" data-anno-for="ref-for-dom-textdecoder①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/TextDecoder" title="The TextDecoder() constructor returns a newly created TextDecoder object for the encoding specified in parameter.">TextDecoder/TextDecoder</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>19+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>38+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>11.0.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-dom-textdecoder-decode①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/decode" title="The TextDecoder.decode() method returns a string containing text decoded from the buffer passed as a parameter.">TextDecoder/decode</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>19+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>38+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>11.0.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-dom-textdecoder-encoding①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/encoding" title="The TextDecoder.encoding read-only property returns a string containing the name of the decoding algorithm used by the specific decoder object.">TextDecoder/encoding</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>19+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>38+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>8.3.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-dom-textdecoder-fatal①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/fatal" title="The fatal read-only property of the TextDecoder interface is a Boolean indicating whether the error mode is fatal.">TextDecoder/fatal</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>36+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>38+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>8.3.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-dom-textdecoder-ignorebom①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/ignoreBOM" title="The ignoreBOM read-only property of the TextDecoder interface is a Boolean indicating whether the byte order mark is ignored.">TextDecoder/ignoreBOM</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>63+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>38+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>8.3.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="interface-textdecoder"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder" title="The TextDecoder interface represents a decoder for a specific text encoding, such as UTF-8, ISO-8859-2, KOI8-R, GBK, etc. A decoder takes a stream of bytes as input and emits a stream of code points.">TextDecoder</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>19+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>38+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>11.0.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-dom-textdecoderstream①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream/TextDecoderStream" title="The TextDecoderStream() constructor creates a new TextDecoderStream object which is used to convert a stream of text in a binary encoding into strings.">TextDecoderStream/TextDecoderStream</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>105+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>71+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.6.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="dom-textdecoder-encoding"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream/encoding" title="The encoding read-only property of the TextDecoderStream interface returns a string containing the name of the encoding algorithm used by the specific decoder.">TextDecoderStream/encoding</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>105+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>71+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.6.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="dom-textdecoder-fatal"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream/fatal" title="The fatal read-only property of the TextDecoderStream interface is a boolean indicating if the error mode of the TextDecoderStream object is set to fatal.">TextDecoderStream/fatal</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>105+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>71+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.6.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="textdecoder-ignore-bom-flag"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream/ignoreBOM" title="The ignoreBOM read-only property of the TextDecoderStream interface returns a boolean indicating if the byte order mark (BOM) is to be ignored.">TextDecoderStream/ignoreBOM</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>105+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>71+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.6.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="interface-textdecoderstream"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream" title="The TextDecoderStream interface of the Encoding API converts a stream of text in a binary encoding, such as UTF-8 etc., to a stream of strings. It is the streaming equivalent of TextDecoder.">TextDecoderStream</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>105+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>71+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>18.0.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-dom-textencoder①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/TextEncoder" title="The TextEncoder() constructor returns a newly created TextEncoder object that will generate a byte stream with UTF-8 encoding.">TextEncoder/TextEncoder</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>18+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>38+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>11.0.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-dom-textencoder-encode①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/encode" title="The TextEncoder.encode() method takes a string as input, and returns a Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.">TextEncoder/encode</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>18+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>38+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>8.3.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-dom-textencoder-encodeinto①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/encodeInto" title="The TextEncoder.encodeInto() method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns a dictionary object indicating the progress of the encoding. This is potentially more performant than the older encode() method — especially when the target buffer is a view into a Wasm heap.">TextEncoder/encodeInto</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>66+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>74+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android yes"><span>Opera Mobile</span><span>50+</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>12.11.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="dom-textencoder-encoding"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/encoding" title="The TextEncoder.encoding read-only property returns a string containing the name of the encoding algorithm used by the specific encoder.">TextEncoder/encoding</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>18+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>38+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>8.3.0+</span></span> </div> </div> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextEncoderStream/encoding" title="The encoding read-only property of the TextEncoderStream interface returns a string containing the name of the encoding algorithm used by the current TextEncoderStream object.">TextEncoderStream/encoding</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>105+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>71+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.6.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="interface-textencoder"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder" title="The TextEncoder interface takes a stream of code points as input and emits a stream of UTF-8 bytes.">TextEncoder</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>18+</span></span><span class="safari yes"><span>Safari</span><span>10.1+</span></span><span class="chrome yes"><span>Chrome</span><span>38+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>11.0.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="ref-for-dom-textencoderstream①"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextEncoderStream/TextEncoderStream" title="The TextEncoderStream() constructor creates a new TextEncoderStream object which is used to convert a stream of strings into bytes using UTF-8 encoding.">TextEncoderStream/TextEncoderStream</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>105+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>71+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>16.6.0+</span></span> </div> </div> </details> <details class="mdn-anno unpositioned" data-anno-for="interface-textencoderstream"> <summary><b class="all-engines-flag" title="This feature is in all current engines.">✔</b><span>MDN</span></summary> <div class="feature"> <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextEncoderStream" title="The TextEncoderStream interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding. It is the streaming equivalent of TextEncoder.">TextEncoderStream</a></p> <p class="all-engines-text">In all current engines.</p> <div class="support"> <span class="firefox yes"><span>Firefox</span><span>105+</span></span><span class="safari yes"><span>Safari</span><span>14.1+</span></span><span class="chrome yes"><span>Chrome</span><span>71+</span></span> <hr> <span class="opera no"><span>Opera</span><span>?</span></span><span class="edge_blink yes"><span>Edge</span><span>79+</span></span> <hr> <span class="edge no"><span>Edge (Legacy)</span><span>?</span></span><span class="ie no"><span>IE</span><span>None</span></span> <hr> <span class="firefox_android no"><span>Firefox for Android</span><span>?</span></span><span class="safari_ios no"><span>iOS Safari</span><span>?</span></span><span class="chrome_android no"><span>Chrome for Android</span><span>?</span></span><span class="webview_android no"><span>Android WebView</span><span>?</span></span><span class="samsunginternet_android no"><span>Samsung Internet</span><span>?</span></span><span class="opera_android no"><span>Opera Mobile</span><span>?</span></span> <hr> <span class="nodejs yes"><span>Node.js</span><span>18.0.0+</span></span> </div> </div> </details> <script>/* Boilerplate: script-dom-helper */ "use strict"; function query(sel) { return document.querySelector(sel); } function queryAll(sel) { return [...document.querySelectorAll(sel)]; } function iter(obj) { if(!obj) return []; var it = obj[Symbol.iterator]; if(it) return it; return Object.entries(obj); } function mk(tagname, attrs, ...children) { const el = document.createElement(tagname); for(const [k,v] of iter(attrs)) { if(k.slice(0,3) == "_on") { const eventName = k.slice(3); el.addEventListener(eventName, v); } else if(k[0] == "_") { // property, not attribute el[k.slice(1)] = v; } else { if(v === false || v == null) { continue; } else if(v === true) { el.setAttribute(k, ""); continue; } else { el.setAttribute(k, v); } } } append(el, children); return el; } /* Create shortcuts for every known HTML element */ [ "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "label", "legend", "li", "link", "main", "map", "mark", "meta", "meter", "nav", "nobr", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "pre", "progress", "q", "s", "samp", "script", "section", "select", "small", "source", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "u", "ul", "var", "video", "wbr", "xmp", ].forEach(tagname=>{ mk[tagname] = (...args) => mk(tagname, ...args); }); function* nodesFromChildList(children) { for(const child of children.flat(Infinity)) { if(child instanceof Node) { yield child; } else { yield new Text(child); } } } function append(el, ...children) { for(const child of nodesFromChildList(children)) { if(el instanceof Node) el.appendChild(child); else el.push(child); } return el; } function insertAfter(el, ...children) { for(const child of nodesFromChildList(children)) { el.parentNode.insertBefore(child, el.nextSibling); } return el; } function clearContents(el) { el.innerHTML = ""; return el; } function parseHTML(markup) { if(markup.toLowerCase().trim().indexOf('<!doctype') === 0) { const doc = document.implementation.createHTMLDocument(""); doc.documentElement.innerHTML = markup; return doc; } else { const el = mk.template({}); el.innerHTML = markup; return el.content; } }</script> <script>/* Boilerplate: script-dfn-panel */ "use strict"; { let dfnPanelData = { "0204d188": {"dfnID":"0204d188","dfnText":"size","external":true,"refSections":[{"refs":[{"id":"ref-for-list-size"},{"id":"ref-for-list-size\u2460"}],"title":"3. Terminology"}],"url":"https://infra.spec.whatwg.org/#list-size"}, "0698d556": {"dfnID":"0698d556","dfnText":"string","external":true,"refSections":[{"refs":[{"id":"ref-for-string"},{"id":"ref-for-string\u2460"}],"title":"3. Terminology"},{"refs":[{"id":"ref-for-string\u2461"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://infra.spec.whatwg.org/#string"}, "13d0450b": {"dfnID":"13d0450b","dfnText":"Uint32Array","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-Uint32Array"},{"id":"ref-for-idl-Uint32Array\u2460"},{"id":"ref-for-idl-Uint32Array\u2461"}],"title":"7. API"}],"url":"https://webidl.spec.whatwg.org/#idl-Uint32Array"}, "14fa5a95": {"dfnID":"14fa5a95","dfnText":"writable stream","external":true,"refSections":[{"refs":[{"id":"ref-for-writable-stream"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-writable-stream\u2460"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://streams.spec.whatwg.org/#writable-stream"}, "16d07e10": {"dfnID":"16d07e10","dfnText":"for each","external":true,"refSections":[{"refs":[{"id":"ref-for-list-iterate"}],"title":"3. Terminology"}],"url":"https://infra.spec.whatwg.org/#list-iterate"}, "2a7798d8": {"dfnID":"2a7798d8","dfnText":"set up","external":true,"refSections":[{"refs":[{"id":"ref-for-transformstream-set-up"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-transformstream-set-up\u2460"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://streams.spec.whatwg.org/#transformstream-set-up"}, "2d10bf58": {"dfnID":"2d10bf58","dfnText":"chunk","external":true,"refSections":[{"refs":[{"id":"ref-for-chunk"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-chunk\u2460"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://streams.spec.whatwg.org/#chunk"}, "2f8afbfe": {"dfnID":"2f8afbfe","dfnText":"ArrayBuffer","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-ArrayBuffer"},{"id":"ref-for-idl-ArrayBuffer\u2460"}],"title":"7. API"},{"refs":[{"id":"ref-for-idl-ArrayBuffer\u2461"},{"id":"ref-for-idl-ArrayBuffer\u2462"}],"title":"7.4. Interface TextEncoder"},{"refs":[{"id":"ref-for-idl-ArrayBuffer\u2463"},{"id":"ref-for-idl-ArrayBuffer\u2464"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://webidl.spec.whatwg.org/#idl-ArrayBuffer"}, "2fb3c1e9": {"dfnID":"2fb3c1e9","dfnText":"readable","external":true,"refSections":[{"refs":[{"id":"ref-for-dom-generictransformstream-readable"},{"id":"ref-for-dom-generictransformstream-readable\u2460"},{"id":"ref-for-dom-generictransformstream-readable\u2461"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-dom-generictransformstream-readable\u2462"},{"id":"ref-for-dom-generictransformstream-readable\u2463"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://streams.spec.whatwg.org/#dom-generictransformstream-readable"}, "3af29886": {"dfnID":"3af29886","dfnText":"flushalgorithm","external":true,"refSections":[{"refs":[{"id":"ref-for-transformstream-set-up-flushalgorithm"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-transformstream-set-up-flushalgorithm\u2460"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://streams.spec.whatwg.org/#transformstream-set-up-flushalgorithm"}, "3de9e659": {"dfnID":"3de9e659","dfnText":"byte sequence","external":true,"refSections":[{"refs":[{"id":"ref-for-byte-sequence"},{"id":"ref-for-byte-sequence\u2460"}],"title":"3. Terminology"}],"url":"https://infra.spec.whatwg.org/#byte-sequence"}, "4013a022": {"dfnID":"4013a022","dfnText":"this","external":true,"refSections":[{"refs":[{"id":"ref-for-this"},{"id":"ref-for-this\u2460"},{"id":"ref-for-this\u2461"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-this\u2462"},{"id":"ref-for-this\u2463"},{"id":"ref-for-this\u2464"},{"id":"ref-for-this\u2465"},{"id":"ref-for-this\u2466"},{"id":"ref-for-this\u2467"},{"id":"ref-for-this\u2468"},{"id":"ref-for-this\u2460\u24ea"},{"id":"ref-for-this\u2460\u2460"},{"id":"ref-for-this\u2460\u2461"},{"id":"ref-for-this\u2460\u2462"},{"id":"ref-for-this\u2460\u2463"},{"id":"ref-for-this\u2460\u2464"},{"id":"ref-for-this\u2460\u2465"},{"id":"ref-for-this\u2460\u2466"},{"id":"ref-for-this\u2460\u2467"},{"id":"ref-for-this\u2460\u2468"},{"id":"ref-for-this\u2461\u24ea"},{"id":"ref-for-this\u2461\u2460"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-this\u2461\u2461"},{"id":"ref-for-this\u2461\u2462"},{"id":"ref-for-this\u2461\u2463"},{"id":"ref-for-this\u2461\u2464"},{"id":"ref-for-this\u2461\u2465"},{"id":"ref-for-this\u2461\u2466"},{"id":"ref-for-this\u2461\u2467"},{"id":"ref-for-this\u2461\u2468"},{"id":"ref-for-this\u2462\u24ea"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-this\u2462\u2460"},{"id":"ref-for-this\u2462\u2461"},{"id":"ref-for-this\u2462\u2462"},{"id":"ref-for-this\u2462\u2463"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://webidl.spec.whatwg.org/#this"}, "453993b2": {"dfnID":"453993b2","dfnText":"trailing surrogate","external":true,"refSections":[{"refs":[{"id":"ref-for-trailing-surrogate"}],"title":"3. Terminology"},{"refs":[{"id":"ref-for-trailing-surrogate\u2460"},{"id":"ref-for-trailing-surrogate\u2461"}],"title":"7.6. Interface TextEncoderStream"},{"refs":[{"id":"ref-for-trailing-surrogate\u2462"},{"id":"ref-for-trailing-surrogate\u2463"}],"title":"14.2.1. shared UTF-16 decoder"}],"url":"https://infra.spec.whatwg.org/#trailing-surrogate"}, "47dfca75": {"dfnID":"47dfca75","dfnText":"queue","external":true,"refSections":[{"refs":[{"id":"ref-for-queue"}],"title":"3. Terminology"}],"url":"https://infra.spec.whatwg.org/#queue"}, "47e93e3e": {"dfnID":"47e93e3e","dfnText":"TransformStream","external":true,"refSections":[{"refs":[{"id":"ref-for-transformstream"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-transformstream\u2460"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://streams.spec.whatwg.org/#transformstream"}, "495737df": {"dfnID":"495737df","dfnText":"byte length","external":true,"refSections":[{"refs":[{"id":"ref-for-buffersource-byte-length"}],"title":"7.4. Interface TextEncoder"}],"url":"https://webidl.spec.whatwg.org/#buffersource-byte-length"}, "4e9534f3": {"dfnID":"4e9534f3","dfnText":"readable stream","external":true,"refSections":[{"refs":[{"id":"ref-for-readable-stream"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-readable-stream\u2460"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://streams.spec.whatwg.org/#readable-stream"}, "53275e46": {"dfnID":"53275e46","dfnText":"append","external":true,"refSections":[{"refs":[{"id":"ref-for-list-append"},{"id":"ref-for-list-append\u2460"},{"id":"ref-for-list-append\u2461"}],"title":"3. Terminology"}],"url":"https://infra.spec.whatwg.org/#list-append"}, "5372cca8": {"dfnID":"5372cca8","dfnText":"boolean","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-boolean"},{"id":"ref-for-idl-boolean\u2460"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-idl-boolean\u2461"},{"id":"ref-for-idl-boolean\u2462"},{"id":"ref-for-idl-boolean\u2463"}],"title":"7.2. Interface TextDecoder"}],"url":"https://webidl.spec.whatwg.org/#idl-boolean"}, "56ad2aed": {"dfnID":"56ad2aed","dfnText":"insert","external":true,"refSections":[{"refs":[{"id":"ref-for-list-insert"}],"title":"3. Terminology"}],"url":"https://infra.spec.whatwg.org/#list-insert"}, "56f81a8e": {"dfnID":"56f81a8e","dfnText":"new","external":true,"refSections":[{"refs":[{"id":"ref-for-new"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-new\u2460"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://webidl.spec.whatwg.org/#new"}, "593deb55": {"dfnID":"593deb55","dfnText":"enqueue","external":true,"refSections":[{"refs":[{"id":"ref-for-transformstream-enqueue"},{"id":"ref-for-transformstream-enqueue\u2460"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-transformstream-enqueue\u2461"},{"id":"ref-for-transformstream-enqueue\u2462"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://streams.spec.whatwg.org/#transformstream-enqueue"}, "59912c93": {"dfnID":"59912c93","dfnText":"code unit","external":true,"refSections":[{"refs":[{"id":"ref-for-code-unit"}],"title":"7.4. Interface TextEncoder"},{"refs":[{"id":"ref-for-code-unit\u2460"},{"id":"ref-for-code-unit\u2461"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://infra.spec.whatwg.org/#code-unit"}, "59ed4e57": {"dfnID":"59ed4e57","dfnText":"ReadableStream","external":true,"refSections":[{"refs":[{"id":"ref-for-readablestream"},{"id":"ref-for-readablestream\u2460"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-readablestream\u2461"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://streams.spec.whatwg.org/#readablestream"}, "5afbefcd": {"dfnID":"5afbefcd","dfnText":"item","external":true,"refSections":[{"refs":[{"id":"ref-for-list-item"},{"id":"ref-for-list-item\u2460"},{"id":"ref-for-list-item\u2461"},{"id":"ref-for-list-item\u2462"},{"id":"ref-for-list-item\u2463"},{"id":"ref-for-list-item\u2464"},{"id":"ref-for-list-item\u2465"},{"id":"ref-for-list-item\u2466"},{"id":"ref-for-list-item\u2467"},{"id":"ref-for-list-item\u2468"},{"id":"ref-for-list-item\u2460\u24ea"},{"id":"ref-for-list-item\u2460\u2460"},{"id":"ref-for-list-item\u2460\u2461"},{"id":"ref-for-list-item\u2460\u2462"}],"title":"3. Terminology"},{"refs":[{"id":"ref-for-list-item\u2460\u2463"},{"id":"ref-for-list-item\u2460\u2464"},{"id":"ref-for-list-item\u2460\u2465"},{"id":"ref-for-list-item\u2460\u2466"}],"title":"4.1. Encoders and decoders"}],"url":"https://infra.spec.whatwg.org/#list-item"}, "5e4b6157": {"dfnID":"5e4b6157","dfnText":"AllowSharedBufferSource","external":true,"refSections":[{"refs":[{"id":"ref-for-AllowSharedBufferSource"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-AllowSharedBufferSource\u2460"},{"id":"ref-for-AllowSharedBufferSource\u2461"}],"title":"7.5. Interface TextDecoderStream"}],"url":"https://webidl.spec.whatwg.org/#AllowSharedBufferSource"}, "5fb1ed8a": {"dfnID":"5fb1ed8a","dfnText":"ascii whitespace","external":true,"refSections":[{"refs":[{"id":"ref-for-ascii-whitespace"}],"title":"4.2. Names and labels"}],"url":"https://infra.spec.whatwg.org/#ascii-whitespace"}, "617d690e": {"dfnID":"617d690e","dfnText":"ascii byte","external":true,"refSections":[{"refs":[{"id":"ref-for-ascii-byte"}],"title":"2. Security background"},{"refs":[{"id":"ref-for-ascii-byte\u2460"}],"title":"9.1. single-byte decoder"},{"refs":[{"id":"ref-for-ascii-byte\u2461"},{"id":"ref-for-ascii-byte\u2462"}],"title":"10.2.1. gb18030 decoder"},{"refs":[{"id":"ref-for-ascii-byte\u2463"},{"id":"ref-for-ascii-byte\u2464"}],"title":"11.1.1. Big5 decoder"},{"refs":[{"id":"ref-for-ascii-byte\u2465"},{"id":"ref-for-ascii-byte\u2466"}],"title":"12.1.1. EUC-JP decoder"},{"refs":[{"id":"ref-for-ascii-byte\u2467"},{"id":"ref-for-ascii-byte\u2468"}],"title":"12.3.1. Shift_JIS decoder"},{"refs":[{"id":"ref-for-ascii-byte\u2460\u24ea"},{"id":"ref-for-ascii-byte\u2460\u2460"}],"title":"13.1.1. EUC-KR decoder"},{"refs":[{"id":"ref-for-ascii-byte\u2460\u2461"}],"title":"14.5.1. x-user-defined decoder"},{"refs":[{"id":"ref-for-ascii-byte\u2460\u2462"}],"title":"Implementation considerations"}],"url":"https://infra.spec.whatwg.org/#ascii-byte"}, "649608b9": {"dfnID":"649608b9","dfnText":"list","external":true,"refSections":[{"refs":[{"id":"ref-for-list"},{"id":"ref-for-list\u2460"},{"id":"ref-for-list\u2461"},{"id":"ref-for-list\u2462"},{"id":"ref-for-list\u2463"},{"id":"ref-for-list\u2464"},{"id":"ref-for-list\u2465"}],"title":"3. Terminology"},{"refs":[{"id":"ref-for-list\u2466"}],"title":"14.2.1. shared UTF-16 decoder"}],"url":"https://infra.spec.whatwg.org/#list"}, "6b815fdd": {"dfnID":"6b815fdd","dfnText":"is empty","external":true,"refSections":[{"refs":[{"id":"ref-for-list-is-empty"}],"title":"3. Terminology"}],"url":"https://infra.spec.whatwg.org/#list-is-empty"}, "6f2dfa22": {"dfnID":"6f2dfa22","dfnText":"ascii lowercase","external":true,"refSections":[{"refs":[{"id":"ref-for-ascii-lowercase"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-ascii-lowercase\u2460"}],"title":"7.1. Interface mixin TextDecoderCommon"}],"url":"https://infra.spec.whatwg.org/#ascii-lowercase"}, "762869d3": {"dfnID":"762869d3","dfnText":"scalar value string","external":true,"refSections":[{"refs":[{"id":"ref-for-scalar-value-string"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://infra.spec.whatwg.org/#scalar-value-string"}, "7b0d918d": {"dfnID":"7b0d918d","dfnText":"break","external":true,"refSections":[{"refs":[{"id":"ref-for-iteration-break"}],"title":"3. Terminology"},{"refs":[{"id":"ref-for-iteration-break\u2460"},{"id":"ref-for-iteration-break\u2461"}],"title":"7.4. Interface TextEncoder"}],"url":"https://infra.spec.whatwg.org/#iteration-break"}, "7f9469b5": {"dfnID":"7f9469b5","dfnText":"ascii case-insensitive","external":true,"refSections":[{"refs":[{"id":"ref-for-ascii-case-insensitive"},{"id":"ref-for-ascii-case-insensitive\u2460"}],"title":"4.2. Names and labels"}],"url":"https://infra.spec.whatwg.org/#ascii-case-insensitive"}, "82ca3efc": {"dfnID":"82ca3efc","dfnText":"TypeError","external":true,"refSections":[{"refs":[{"id":"ref-for-exceptiondef-typeerror"},{"id":"ref-for-exceptiondef-typeerror\u2460"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-exceptiondef-typeerror\u2461"},{"id":"ref-for-exceptiondef-typeerror\u2462"},{"id":"ref-for-exceptiondef-typeerror\u2463"}],"title":"7.5. Interface TextDecoderStream"}],"url":"https://webidl.spec.whatwg.org/#exceptiondef-typeerror"}, "8855a9aa": {"dfnID":"8855a9aa","dfnText":"DOMString","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-DOMString"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-idl-DOMString\u2460"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-idl-DOMString\u2461"}],"title":"7.3. Interface mixin TextEncoderCommon"},{"refs":[{"id":"ref-for-idl-DOMString\u2462"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-idl-DOMString\u2463"},{"id":"ref-for-idl-DOMString\u2464"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://webidl.spec.whatwg.org/#idl-DOMString"}, "904cdc91": {"dfnID":"904cdc91","dfnText":"starts with","external":true,"refSections":[{"refs":[{"id":"ref-for-byte-sequence-starts-with"}],"title":"6.1. Legacy hooks for standards"}],"url":"https://infra.spec.whatwg.org/#byte-sequence-starts-with"}, "915aff5e": {"dfnID":"915aff5e","dfnText":"code point","external":true,"refSections":[{"refs":[{"id":"ref-for-code-point"},{"id":"ref-for-code-point\u2460"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-code-point\u2461"},{"id":"ref-for-code-point\u2462"}],"title":"6.1. Legacy hooks for standards"}],"url":"https://infra.spec.whatwg.org/#code-point"}, "92d13070": {"dfnID":"92d13070","dfnText":"get a copy of the buffer source","external":true,"refSections":[{"refs":[{"id":"ref-for-dfn-get-buffer-source-copy"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-dfn-get-buffer-source-copy\u2460"}],"title":"7.5. Interface TextDecoderStream"}],"url":"https://webidl.spec.whatwg.org/#dfn-get-buffer-source-copy"}, "95d7775a": {"dfnID":"95d7775a","dfnText":"Uint8Array","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-Uint8Array"}],"title":"7. API"},{"refs":[{"id":"ref-for-idl-Uint8Array\u2460"},{"id":"ref-for-idl-Uint8Array\u2461"},{"id":"ref-for-idl-Uint8Array\u2462"}],"title":"7.4. Interface TextEncoder"},{"refs":[{"id":"ref-for-idl-Uint8Array\u2463"},{"id":"ref-for-idl-Uint8Array\u2464"},{"id":"ref-for-idl-Uint8Array\u2465"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://webidl.spec.whatwg.org/#idl-Uint8Array"}, "97ba5569": {"dfnID":"97ba5569","dfnText":"writable","external":true,"refSections":[{"refs":[{"id":"ref-for-dom-generictransformstream-writable"},{"id":"ref-for-dom-generictransformstream-writable\u2460"},{"id":"ref-for-dom-generictransformstream-writable\u2461"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-dom-generictransformstream-writable\u2462"},{"id":"ref-for-dom-generictransformstream-writable\u2463"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://streams.spec.whatwg.org/#dom-generictransformstream-writable"}, "99c988d6": {"dfnID":"99c988d6","dfnText":"remove","external":true,"refSections":[{"refs":[{"id":"ref-for-list-remove"},{"id":"ref-for-list-remove\u2460"}],"title":"3. Terminology"}],"url":"https://infra.spec.whatwg.org/#list-remove"}, "a088e610": {"dfnID":"a088e610","dfnText":"convert","external":true,"refSections":[{"refs":[{"id":"ref-for-javascript-string-convert"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://infra.spec.whatwg.org/#javascript-string-convert"}, "a3fb968a": {"dfnID":"a3fb968a","dfnText":"surrogate","external":true,"refSections":[{"refs":[{"id":"ref-for-surrogate"},{"id":"ref-for-surrogate\u2460"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-surrogate\u2461"}],"title":"6. Hooks for standards"}],"url":"https://infra.spec.whatwg.org/#surrogate"}, "a72449dd": {"dfnID":"a72449dd","dfnText":"in parallel","external":true,"refSections":[{"refs":[{"id":"ref-for-in-parallel"}],"title":"3. Terminology"},{"refs":[{"id":"ref-for-in-parallel\u2460"}],"title":"6. Hooks for standards"}],"url":"https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel"}, "ae200f87": {"dfnID":"ae200f87","dfnText":"leading surrogate","external":true,"refSections":[{"refs":[{"id":"ref-for-leading-surrogate"}],"title":"3. Terminology"},{"refs":[{"id":"ref-for-leading-surrogate\u2460"},{"id":"ref-for-leading-surrogate\u2461"}],"title":"7.6. Interface TextEncoderStream"},{"refs":[{"id":"ref-for-leading-surrogate\u2462"}],"title":"14.2.1. shared UTF-16 decoder"}],"url":"https://infra.spec.whatwg.org/#leading-surrogate"}, "ae8def21": {"dfnID":"ae8def21","dfnText":"contain","external":true,"refSections":[{"refs":[{"id":"ref-for-list-contain"},{"id":"ref-for-list-contain\u2460"}],"title":"3. Terminology"}],"url":"https://infra.spec.whatwg.org/#list-contain"}, "b0d7f3c3": {"dfnID":"b0d7f3c3","dfnText":"USVString","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-USVString"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-idl-USVString\u2460"},{"id":"ref-for-idl-USVString\u2461"}],"title":"7.4. Interface TextEncoder"},{"refs":[{"id":"ref-for-idl-USVString\u2462"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://webidl.spec.whatwg.org/#idl-USVString"}, "b1e3ba8e": {"dfnID":"b1e3ba8e","dfnText":"AllowShared","external":true,"refSections":[{"refs":[{"id":"ref-for-AllowShared"}],"title":"7.4. Interface TextEncoder"}],"url":"https://webidl.spec.whatwg.org/#AllowShared"}, "b4cfa5ce": {"dfnID":"b4cfa5ce","dfnText":"throw","external":true,"refSections":[{"refs":[{"id":"ref-for-dfn-throw"},{"id":"ref-for-dfn-throw\u2460"},{"id":"ref-for-dfn-throw\u2461"},{"id":"ref-for-dfn-throw\u2462"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-dfn-throw\u2463"},{"id":"ref-for-dfn-throw\u2464"},{"id":"ref-for-dfn-throw\u2465"},{"id":"ref-for-dfn-throw\u2466"}],"title":"7.5. Interface TextDecoderStream"}],"url":"https://webidl.spec.whatwg.org/#dfn-throw"}, "bb049306": {"dfnID":"bb049306","dfnText":"value","external":true,"refSections":[{"refs":[{"id":"ref-for-code-point-value"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-code-point-value\u2460"}],"title":"6.1. Legacy hooks for standards"}],"url":"https://infra.spec.whatwg.org/#code-point-value"}, "big5": {"dfnID":"big5","dfnText":"11.1. Big5","external":false,"refSections":[{"refs":[{"id":"ref-for-big5"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-big5"}],"title":"11.1. Big5"},{"refs":[{"id":"ref-for-big5\u2460"},{"id":"ref-for-big5\u2461"}],"title":"11.1.1. Big5 decoder"},{"refs":[{"id":"ref-for-big5\u2462"}],"title":"11.1.2. Big5 encoder"}],"url":"#big5"}, "big5-decoder": {"dfnID":"big5-decoder","dfnText":"11.1.1. Big5 decoder","external":false,"refSections":[{"refs":[{"id":"ref-for-big5-decoder"}],"title":"11.1.1. Big5 decoder"}],"url":"#big5-decoder"}, "big5-encoder": {"dfnID":"big5-encoder","dfnText":"11.1.2. Big5 encoder","external":false,"refSections":[{"refs":[{"id":"ref-for-big5-encoder"}],"title":"11.1.2. Big5 encoder"}],"url":"#big5-encoder"}, "big5-lead": {"dfnID":"big5-lead","dfnText":"Big5 lead","external":false,"refSections":[{"refs":[{"id":"ref-for-big5-lead"},{"id":"ref-for-big5-lead\u2460"},{"id":"ref-for-big5-lead\u2461"},{"id":"ref-for-big5-lead\u2462"},{"id":"ref-for-big5-lead\u2463"},{"id":"ref-for-big5-lead\u2464"},{"id":"ref-for-big5-lead\u2465"}],"title":"11.1.1. Big5 decoder"}],"url":"#big5-lead"}, "bom-sniff": {"dfnID":"bom-sniff","dfnText":"BOM sniff","external":false,"refSections":[{"refs":[{"id":"ref-for-bom-sniff"},{"id":"ref-for-bom-sniff\u2460"}],"title":"6.1. Legacy hooks for standards"}],"url":"#bom-sniff"}, "c1bd634e": {"dfnID":"c1bd634e","dfnText":"pipeThrough(transform)","external":true,"refSections":[{"refs":[{"id":"ref-for-rs-pipe-through"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-rs-pipe-through\u2460"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://streams.spec.whatwg.org/#rs-pipe-through"}, "c6d19e56": {"dfnID":"c6d19e56","dfnText":"event loop","external":true,"refSections":[{"refs":[{"id":"ref-for-event-loop"}],"title":"3. Terminology"}],"url":"https://html.spec.whatwg.org/multipage/webappapis.html#event-loop"}, "c7574ff1": {"dfnID":"c7574ff1","dfnText":"transformalgorithm","external":true,"refSections":[{"refs":[{"id":"ref-for-transformstream-set-up-transformalgorithm"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-transformstream-set-up-transformalgorithm\u2460"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://streams.spec.whatwg.org/#transformstream-set-up-transformalgorithm"}, "c807e273": {"dfnID":"c807e273","dfnText":"NewObject","external":true,"refSections":[{"refs":[{"id":"ref-for-NewObject"}],"title":"7.4. Interface TextEncoder"}],"url":"https://webidl.spec.whatwg.org/#NewObject"}, "cadf5fe9": {"dfnID":"cadf5fe9","dfnText":"converted to an idl value","external":true,"refSections":[{"refs":[{"id":"ref-for-dfn-convert-ecmascript-to-idl-value"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-dfn-convert-ecmascript-to-idl-value\u2460"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://webidl.spec.whatwg.org/#dfn-convert-ecmascript-to-idl-value"}, "concept-encoding-get": {"dfnID":"concept-encoding-get","dfnText":"get an encoding","external":false,"refSections":[{"refs":[{"id":"ref-for-concept-encoding-get"}],"title":"6.1. Legacy hooks for standards"},{"refs":[{"id":"ref-for-concept-encoding-get\u2460"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-concept-encoding-get\u2461"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#concept-encoding-get"}, "concept-encoding-process": {"dfnID":"concept-encoding-process","dfnText":"process an item","external":false,"refSections":[{"refs":[{"id":"ref-for-concept-encoding-process"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-concept-encoding-process\u2460"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-concept-encoding-process\u2461"}],"title":"7.4. Interface TextEncoder"},{"refs":[{"id":"ref-for-concept-encoding-process\u2462"},{"id":"ref-for-concept-encoding-process\u2463"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-concept-encoding-process\u2464"}],"title":"7.6. Interface TextEncoderStream"}],"url":"#concept-encoding-process"}, "concept-encoding-run": {"dfnID":"concept-encoding-run","dfnText":"process a queue","external":false,"refSections":[{"refs":[{"id":"ref-for-concept-encoding-run"},{"id":"ref-for-concept-encoding-run\u2460"},{"id":"ref-for-concept-encoding-run\u2461"}],"title":"6. Hooks for standards"},{"refs":[{"id":"ref-for-concept-encoding-run\u2462"},{"id":"ref-for-concept-encoding-run\u2463"},{"id":"ref-for-concept-encoding-run\u2464"}],"title":"6.1. Legacy hooks for standards"}],"url":"#concept-encoding-run"}, "concept-stream": {"dfnID":"concept-stream","dfnText":"I/O queue","external":false,"refSections":[{"refs":[{"id":"ref-for-concept-stream"},{"id":"ref-for-concept-stream\u2460"},{"id":"ref-for-concept-stream\u2461"},{"id":"ref-for-concept-stream\u2462"},{"id":"ref-for-concept-stream\u2463"},{"id":"ref-for-concept-stream\u2464"},{"id":"ref-for-concept-stream\u2465"},{"id":"ref-for-concept-stream\u2466"},{"id":"ref-for-concept-stream\u2467"},{"id":"ref-for-concept-stream\u2468"},{"id":"ref-for-concept-stream\u2460\u24ea"},{"id":"ref-for-concept-stream\u2460\u2460"},{"id":"ref-for-concept-stream\u2460\u2461"},{"id":"ref-for-concept-stream\u2460\u2462"},{"id":"ref-for-concept-stream\u2460\u2463"}],"title":"3. Terminology"},{"refs":[{"id":"ref-for-concept-stream\u2460\u2464"},{"id":"ref-for-concept-stream\u2460\u2465"},{"id":"ref-for-concept-stream\u2460\u2466"},{"id":"ref-for-concept-stream\u2460\u2467"},{"id":"ref-for-concept-stream\u2460\u2468"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-concept-stream\u2461\u24ea"},{"id":"ref-for-concept-stream\u2461\u2460"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-concept-stream\u2461\u2461"},{"id":"ref-for-concept-stream\u2461\u2462"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-concept-stream\u2461\u2463"},{"id":"ref-for-concept-stream\u2461\u2464"},{"id":"ref-for-concept-stream\u2461\u2465"},{"id":"ref-for-concept-stream\u2461\u2466"}],"title":"7.4. Interface TextEncoder"},{"refs":[{"id":"ref-for-concept-stream\u2461\u2467"},{"id":"ref-for-concept-stream\u2461\u2468"},{"id":"ref-for-concept-stream\u2462\u24ea"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-concept-stream\u2462\u2460"},{"id":"ref-for-concept-stream\u2462\u2461"},{"id":"ref-for-concept-stream\u2462\u2462"},{"id":"ref-for-concept-stream\u2462\u2463"}],"title":"7.6. Interface TextEncoderStream"},{"refs":[{"id":"ref-for-concept-stream\u2462\u2464"}],"title":"Implementation considerations"}],"url":"#concept-stream"}, "concept-stream-prepend": {"dfnID":"concept-stream-prepend","dfnText":"restore","external":false,"refSections":[{"refs":[{"id":"ref-for-concept-stream-prepend"},{"id":"ref-for-concept-stream-prepend\u2460"}],"title":"3. Terminology"},{"refs":[{"id":"ref-for-concept-stream-prepend\u2461"}],"title":"7.6. Interface TextEncoderStream"},{"refs":[{"id":"ref-for-concept-stream-prepend\u2462"}],"title":"8.1.1. UTF-8 decoder"},{"refs":[{"id":"ref-for-concept-stream-prepend\u2463"},{"id":"ref-for-concept-stream-prepend\u2464"},{"id":"ref-for-concept-stream-prepend\u2465"}],"title":"10.2.1. gb18030 decoder"},{"refs":[{"id":"ref-for-concept-stream-prepend\u2466"}],"title":"11.1.1. Big5 decoder"},{"refs":[{"id":"ref-for-concept-stream-prepend\u2467"}],"title":"12.1.1. EUC-JP decoder"},{"refs":[{"id":"ref-for-concept-stream-prepend\u2468"},{"id":"ref-for-concept-stream-prepend\u2460\u24ea"},{"id":"ref-for-concept-stream-prepend\u2460\u2460"}],"title":"12.2.1. ISO-2022-JP decoder"},{"refs":[{"id":"ref-for-concept-stream-prepend\u2460\u2461"},{"id":"ref-for-concept-stream-prepend\u2460\u2462"},{"id":"ref-for-concept-stream-prepend\u2460\u2463"},{"id":"ref-for-concept-stream-prepend\u2460\u2464"}],"title":"12.2.2. ISO-2022-JP encoder"},{"refs":[{"id":"ref-for-concept-stream-prepend\u2460\u2465"}],"title":"12.3.1. Shift_JIS decoder"},{"refs":[{"id":"ref-for-concept-stream-prepend\u2460\u2466"}],"title":"13.1.1. EUC-KR decoder"},{"refs":[{"id":"ref-for-concept-stream-prepend\u2460\u2467"}],"title":"14.2.1. shared UTF-16 decoder"},{"refs":[{"id":"ref-for-concept-stream-prepend\u2460\u2468"}],"title":"Implementation considerations"}],"url":"#concept-stream-prepend"}, "concept-stream-push": {"dfnID":"concept-stream-push","dfnText":"push","external":false,"refSections":[{"refs":[{"id":"ref-for-concept-stream-push"},{"id":"ref-for-concept-stream-push\u2460"},{"id":"ref-for-concept-stream-push\u2461"}],"title":"3. Terminology"},{"refs":[{"id":"ref-for-concept-stream-push\u2462"},{"id":"ref-for-concept-stream-push\u2463"},{"id":"ref-for-concept-stream-push\u2464"},{"id":"ref-for-concept-stream-push\u2465"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-concept-stream-push\u2466"}],"title":"6.1. Legacy hooks for standards"},{"refs":[{"id":"ref-for-concept-stream-push\u2467"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-concept-stream-push\u2468"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#concept-stream-push"}, "concept-stream-read": {"dfnID":"concept-stream-read","dfnText":"read","external":false,"refSections":[{"refs":[{"id":"ref-for-concept-stream-read"},{"id":"ref-for-concept-stream-read\u2460"},{"id":"ref-for-concept-stream-read\u2461"},{"id":"ref-for-concept-stream-read\u2462"}],"title":"3. Terminology"},{"refs":[{"id":"ref-for-concept-stream-read\u2463"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-concept-stream-read\u2464"}],"title":"6. Hooks for standards"},{"refs":[{"id":"ref-for-concept-stream-read\u2465"},{"id":"ref-for-concept-stream-read\u2466"}],"title":"6.1. Legacy hooks for standards"},{"refs":[{"id":"ref-for-concept-stream-read\u2467"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-concept-stream-read\u2468"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-concept-stream-read\u2460\u24ea"},{"id":"ref-for-concept-stream-read\u2460\u2460"}],"title":"7.4. Interface TextEncoder"},{"refs":[{"id":"ref-for-concept-stream-read\u2460\u2461"},{"id":"ref-for-concept-stream-read\u2460\u2462"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-concept-stream-read\u2460\u2463"}],"title":"7.6. Interface TextEncoderStream"}],"url":"#concept-stream-read"}, "concept-td-serialize": {"dfnID":"concept-td-serialize","dfnText":"serialize I/O queue","external":false,"refSections":[{"refs":[{"id":"ref-for-concept-td-serialize"},{"id":"ref-for-concept-td-serialize\u2460"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-concept-td-serialize\u2461"},{"id":"ref-for-concept-td-serialize\u2462"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#concept-td-serialize"}, "continue": {"dfnID":"continue","dfnText":"continue","external":false,"refSections":[{"refs":[{"id":"ref-for-continue"},{"id":"ref-for-continue\u2460"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-continue\u2461"},{"id":"ref-for-continue\u2462"}],"title":"7.6. Interface TextEncoderStream"},{"refs":[{"id":"ref-for-continue\u2463"},{"id":"ref-for-continue\u2464"}],"title":"8.1.1. UTF-8 decoder"},{"refs":[{"id":"ref-for-continue\u2465"},{"id":"ref-for-continue\u2466"},{"id":"ref-for-continue\u2467"}],"title":"10.2.1. gb18030 decoder"},{"refs":[{"id":"ref-for-continue\u2468"}],"title":"11.1.1. Big5 decoder"},{"refs":[{"id":"ref-for-continue\u2460\u24ea"},{"id":"ref-for-continue\u2460\u2460"}],"title":"12.1.1. EUC-JP decoder"},{"refs":[{"id":"ref-for-continue\u2460\u2461"},{"id":"ref-for-continue\u2460\u2462"},{"id":"ref-for-continue\u2460\u2463"},{"id":"ref-for-continue\u2460\u2464"},{"id":"ref-for-continue\u2460\u2465"},{"id":"ref-for-continue\u2460\u2466"},{"id":"ref-for-continue\u2460\u2467"}],"title":"12.2.1. ISO-2022-JP decoder"},{"refs":[{"id":"ref-for-continue\u2460\u2468"}],"title":"12.3.1. Shift_JIS decoder"},{"refs":[{"id":"ref-for-continue\u2461\u24ea"}],"title":"13.1.1. EUC-KR decoder"},{"refs":[{"id":"ref-for-continue\u2461\u2460"},{"id":"ref-for-continue\u2461\u2461"}],"title":"14.2.1. shared UTF-16 decoder"}],"url":"#continue"}, "convert-code-unit-to-scalar-value": {"dfnID":"convert-code-unit-to-scalar-value","dfnText":"convert code unit to scalar value","external":false,"refSections":[{"refs":[{"id":"ref-for-convert-code-unit-to-scalar-value"}],"title":"7.6. Interface TextEncoderStream"}],"url":"#convert-code-unit-to-scalar-value"}, "d61c5cab": {"dfnID":"d61c5cab","dfnText":"GenericTransformStream","external":true,"refSections":[{"refs":[{"id":"ref-for-generictransformstream"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-generictransformstream\u2460"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://streams.spec.whatwg.org/#generictransformstream"}, "ddc587b1": {"dfnID":"ddc587b1","dfnText":"ascii code point","external":true,"refSections":[{"refs":[{"id":"ref-for-ascii-code-point"}],"title":"2. Security background"},{"refs":[{"id":"ref-for-ascii-code-point\u2460"}],"title":"8.1.2. UTF-8 encoder"},{"refs":[{"id":"ref-for-ascii-code-point\u2461"}],"title":"9.2. single-byte encoder"},{"refs":[{"id":"ref-for-ascii-code-point\u2462"}],"title":"10.2.2. gb18030 encoder"},{"refs":[{"id":"ref-for-ascii-code-point\u2463"}],"title":"11.1.2. Big5 encoder"},{"refs":[{"id":"ref-for-ascii-code-point\u2464"}],"title":"12.1.2. EUC-JP encoder"},{"refs":[{"id":"ref-for-ascii-code-point\u2465"},{"id":"ref-for-ascii-code-point\u2466"},{"id":"ref-for-ascii-code-point\u2467"},{"id":"ref-for-ascii-code-point\u2468"}],"title":"12.2.2. ISO-2022-JP encoder"},{"refs":[{"id":"ref-for-ascii-code-point\u2460\u24ea"}],"title":"12.3.2. Shift_JIS encoder"},{"refs":[{"id":"ref-for-ascii-code-point\u2460\u2460"}],"title":"13.1.2. EUC-KR encoder"},{"refs":[{"id":"ref-for-ascii-code-point\u2460\u2461"}],"title":"14.5.2. x-user-defined encoder"}],"url":"https://infra.spec.whatwg.org/#ascii-code-point"}, "decode": {"dfnID":"decode","dfnText":"decode","external":false,"refSections":[{"refs":[{"id":"ref-for-decode"}],"title":"6. Hooks for standards"},{"refs":[{"id":"ref-for-decode\u2460"},{"id":"ref-for-decode\u2461"},{"id":"ref-for-decode\u2462"}],"title":"6.1. Legacy hooks for standards"},{"refs":[{"id":"ref-for-decode\u2463"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-decode\u2464"}],"title":"8.1.1. UTF-8 decoder"},{"refs":[{"id":"ref-for-decode\u2465"}],"title":"14.2.1. shared UTF-16 decoder"}],"url":"#decode"}, "decode-and-enqueue-a-chunk": {"dfnID":"decode-and-enqueue-a-chunk","dfnText":"decode and enqueue a chunk","external":false,"refSections":[{"refs":[{"id":"ref-for-decode-and-enqueue-a-chunk"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#decode-and-enqueue-a-chunk"}, "decoder": {"dfnID":"decoder","dfnText":"decoder","external":false,"refSections":[{"refs":[{"id":"ref-for-decoder"},{"id":"ref-for-decoder\u2460"},{"id":"ref-for-decoder\u2461"},{"id":"ref-for-decoder\u2462"},{"id":"ref-for-decoder\u2463"},{"id":"ref-for-decoder\u2464"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-decoder\u2465"}],"title":"5. Indexes"},{"refs":[{"id":"ref-for-decoder\u2466"},{"id":"ref-for-decoder\u2467"},{"id":"ref-for-decoder\u2468"}],"title":"6. Hooks for standards"},{"refs":[{"id":"ref-for-decoder\u2460\u24ea"}],"title":"6.1. Legacy hooks for standards"},{"refs":[{"id":"ref-for-decoder\u2460\u2460"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-decoder\u2460\u2461"},{"id":"ref-for-decoder\u2460\u2462"},{"id":"ref-for-decoder\u2460\u2463"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-decoder\u2460\u2464"},{"id":"ref-for-decoder\u2460\u2465"},{"id":"ref-for-decoder\u2460\u2466"},{"id":"ref-for-decoder\u2460\u2467"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-decoder\u2460\u2468"},{"id":"ref-for-decoder\u2461\u24ea"}],"title":"8.1.1. UTF-8 decoder"},{"refs":[{"id":"ref-for-decoder\u2461\u2460"}],"title":"9. Legacy single-byte encodings"},{"refs":[{"id":"ref-for-decoder\u2461\u2461"}],"title":"9.1. single-byte decoder"},{"refs":[{"id":"ref-for-decoder\u2461\u2462"},{"id":"ref-for-decoder\u2461\u2463"}],"title":"10.1.1. GBK decoder"},{"refs":[{"id":"ref-for-decoder\u2461\u2464"},{"id":"ref-for-decoder\u2461\u2465"}],"title":"10.2.1. gb18030 decoder"},{"refs":[{"id":"ref-for-decoder\u2461\u2466"},{"id":"ref-for-decoder\u2461\u2467"}],"title":"11.1.1. Big5 decoder"},{"refs":[{"id":"ref-for-decoder\u2461\u2468"},{"id":"ref-for-decoder\u2462\u24ea"}],"title":"12.1.1. EUC-JP decoder"},{"refs":[{"id":"ref-for-decoder\u2462\u2460"},{"id":"ref-for-decoder\u2462\u2461"}],"title":"12.2.1. ISO-2022-JP decoder"},{"refs":[{"id":"ref-for-decoder\u2462\u2462"}],"title":"12.2.2. ISO-2022-JP encoder"},{"refs":[{"id":"ref-for-decoder\u2462\u2463"},{"id":"ref-for-decoder\u2462\u2464"}],"title":"12.3.1. Shift_JIS decoder"},{"refs":[{"id":"ref-for-decoder\u2462\u2465"},{"id":"ref-for-decoder\u2462\u2466"}],"title":"13.1.1. EUC-KR decoder"},{"refs":[{"id":"ref-for-decoder\u2462\u2467"},{"id":"ref-for-decoder\u2462\u2468"}],"title":"14.1.1. replacement decoder"},{"refs":[{"id":"ref-for-decoder\u2463\u24ea"}],"title":"14.3.1. UTF-16BE decoder"},{"refs":[{"id":"ref-for-decoder\u2463\u2460"}],"title":"14.4.1. UTF-16LE decoder"},{"refs":[{"id":"ref-for-decoder\u2463\u2461"}],"title":"14.5.1. x-user-defined decoder"},{"refs":[{"id":"ref-for-decoder\u2463\u2462"}],"title":"Implementation considerations"}],"url":"#decoder"}, "df3c9a3c": {"dfnID":"df3c9a3c","dfnText":"startingoffset","external":true,"refSections":[{"refs":[{"id":"ref-for-arraybufferview-write-startingoffset"}],"title":"7.4. Interface TextEncoder"}],"url":"https://webidl.spec.whatwg.org/#arraybufferview-write-startingoffset"}, "dictdef-textencoderencodeintoresult": {"dfnID":"dictdef-textencoderencodeintoresult","dfnText":"TextEncoderEncodeIntoResult","external":false,"refSections":[{"refs":[{"id":"ref-for-dictdef-textencoderencodeintoresult"}],"title":"7.4. Interface TextEncoder"}],"url":"#dictdef-textencoderencodeintoresult"}, "dom-textdecodeoptions-stream": {"dfnID":"dom-textdecodeoptions-stream","dfnText":"stream","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-textdecodeoptions-stream"}],"title":"7.2. Interface TextDecoder"}],"url":"#dom-textdecodeoptions-stream"}, "dom-textdecoder": {"dfnID":"dom-textdecoder","dfnText":"new TextDecoder(label, options)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-textdecoder"},{"id":"ref-for-dom-textdecoder\u2460"}],"title":"7.2. Interface TextDecoder"}],"url":"#dom-textdecoder"}, "dom-textdecoder-decode": {"dfnID":"dom-textdecoder-decode","dfnText":"decode(input, options)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-textdecoder-decode"},{"id":"ref-for-dom-textdecoder-decode\u2460"},{"id":"ref-for-dom-textdecoder-decode\u2461"}],"title":"7.2. Interface TextDecoder"}],"url":"#dom-textdecoder-decode"}, "dom-textdecoder-decode-input-options-input": {"dfnID":"dom-textdecoder-decode-input-options-input","dfnText":"input","external":false,"refSections":[],"url":"#dom-textdecoder-decode-input-options-input"}, "dom-textdecoder-decode-input-options-options": {"dfnID":"dom-textdecoder-decode-input-options-options","dfnText":"options","external":false,"refSections":[],"url":"#dom-textdecoder-decode-input-options-options"}, "dom-textdecoder-encoding": {"dfnID":"dom-textdecoder-encoding","dfnText":"encoding","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-textdecoder-encoding"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-dom-textdecoder-encoding\u2460"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-dom-textdecoder-encoding\u2461"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#dom-textdecoder-encoding"}, "dom-textdecoder-fatal": {"dfnID":"dom-textdecoder-fatal","dfnText":"fatal","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-textdecoder-fatal"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-dom-textdecoder-fatal\u2460"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-dom-textdecoder-fatal\u2461"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#dom-textdecoder-fatal"}, "dom-textdecoder-ignorebom": {"dfnID":"dom-textdecoder-ignorebom","dfnText":"ignoreBOM","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-textdecoder-ignorebom"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-dom-textdecoder-ignorebom\u2460"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-dom-textdecoder-ignorebom\u2461"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#dom-textdecoder-ignorebom"}, "dom-textdecoder-textdecoder-label-options-label": {"dfnID":"dom-textdecoder-textdecoder-label-options-label","dfnText":"label","external":false,"refSections":[],"url":"#dom-textdecoder-textdecoder-label-options-label"}, "dom-textdecoder-textdecoder-label-options-options": {"dfnID":"dom-textdecoder-textdecoder-label-options-options","dfnText":"options","external":false,"refSections":[],"url":"#dom-textdecoder-textdecoder-label-options-options"}, "dom-textdecoderoptions-fatal": {"dfnID":"dom-textdecoderoptions-fatal","dfnText":"fatal","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-textdecoderoptions-fatal"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-dom-textdecoderoptions-fatal\u2460"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#dom-textdecoderoptions-fatal"}, "dom-textdecoderoptions-ignorebom": {"dfnID":"dom-textdecoderoptions-ignorebom","dfnText":"ignoreBOM","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-textdecoderoptions-ignorebom"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-dom-textdecoderoptions-ignorebom\u2460"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#dom-textdecoderoptions-ignorebom"}, "dom-textdecoderstream": {"dfnID":"dom-textdecoderstream","dfnText":"new TextDecoderStream(label, options)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-textdecoderstream"},{"id":"ref-for-dom-textdecoderstream\u2460"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#dom-textdecoderstream"}, "dom-textdecoderstream-textdecoderstream-label-options-label": {"dfnID":"dom-textdecoderstream-textdecoderstream-label-options-label","dfnText":"label","external":false,"refSections":[],"url":"#dom-textdecoderstream-textdecoderstream-label-options-label"}, "dom-textdecoderstream-textdecoderstream-label-options-options": {"dfnID":"dom-textdecoderstream-textdecoderstream-label-options-options","dfnText":"options","external":false,"refSections":[],"url":"#dom-textdecoderstream-textdecoderstream-label-options-options"}, "dom-textencoder": {"dfnID":"dom-textencoder","dfnText":"new TextEncoder()","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-textencoder"},{"id":"ref-for-dom-textencoder\u2460"}],"title":"7.4. Interface TextEncoder"}],"url":"#dom-textencoder"}, "dom-textencoder-encode": {"dfnID":"dom-textencoder-encode","dfnText":"encode(input)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-textencoder-encode"},{"id":"ref-for-dom-textencoder-encode\u2460"}],"title":"7.4. Interface TextEncoder"}],"url":"#dom-textencoder-encode"}, "dom-textencoder-encode-input-input": {"dfnID":"dom-textencoder-encode-input-input","dfnText":"input","external":false,"refSections":[],"url":"#dom-textencoder-encode-input-input"}, "dom-textencoder-encodeinto": {"dfnID":"dom-textencoder-encodeinto","dfnText":"encodeInto(source, destination)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-textencoder-encodeinto"},{"id":"ref-for-dom-textencoder-encodeinto\u2460"},{"id":"ref-for-dom-textencoder-encodeinto\u2461"}],"title":"7.4. Interface TextEncoder"}],"url":"#dom-textencoder-encodeinto"}, "dom-textencoder-encodeinto-source-destination-destination": {"dfnID":"dom-textencoder-encodeinto-source-destination-destination","dfnText":"destination","external":false,"refSections":[],"url":"#dom-textencoder-encodeinto-source-destination-destination"}, "dom-textencoder-encodeinto-source-destination-source": {"dfnID":"dom-textencoder-encodeinto-source-destination-source","dfnText":"source","external":false,"refSections":[],"url":"#dom-textencoder-encodeinto-source-destination-source"}, "dom-textencoder-encoding": {"dfnID":"dom-textencoder-encoding","dfnText":"encoding","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-textencoder-encoding"}],"title":"7.3. Interface mixin TextEncoderCommon"},{"refs":[{"id":"ref-for-dom-textencoder-encoding\u2460"}],"title":"7.4. Interface TextEncoder"},{"refs":[{"id":"ref-for-dom-textencoder-encoding\u2461"}],"title":"7.6. Interface TextEncoderStream"}],"url":"#dom-textencoder-encoding"}, "dom-textencoderencodeintoresult-read": {"dfnID":"dom-textencoderencodeintoresult-read","dfnText":"read","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-textencoderencodeintoresult-read"},{"id":"ref-for-dom-textencoderencodeintoresult-read\u2460"}],"title":"7.4. Interface TextEncoder"}],"url":"#dom-textencoderencodeintoresult-read"}, "dom-textencoderencodeintoresult-written": {"dfnID":"dom-textencoderencodeintoresult-written","dfnText":"written","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-textencoderencodeintoresult-written"},{"id":"ref-for-dom-textencoderencodeintoresult-written\u2460"}],"title":"7.4. Interface TextEncoder"}],"url":"#dom-textencoderencodeintoresult-written"}, "dom-textencoderstream": {"dfnID":"dom-textencoderstream","dfnText":"new TextEncoderStream()","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-textencoderstream"},{"id":"ref-for-dom-textencoderstream\u2460"}],"title":"7.6. Interface TextEncoderStream"}],"url":"#dom-textencoderstream"}, "e2fc6023": {"dfnID":"e2fc6023","dfnText":"prepend","external":true,"refSections":[{"refs":[{"id":"ref-for-list-prepend"}],"title":"3. Terminology"}],"url":"https://infra.spec.whatwg.org/#list-prepend"}, "eade7401": {"dfnID":"eade7401","dfnText":"transform","external":true,"refSections":[{"refs":[{"id":"ref-for-generictransformstream-transform"},{"id":"ref-for-generictransformstream-transform\u2460"},{"id":"ref-for-generictransformstream-transform\u2461"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-generictransformstream-transform\u2462"},{"id":"ref-for-generictransformstream-transform\u2463"},{"id":"ref-for-generictransformstream-transform\u2464"}],"title":"7.6. Interface TextEncoderStream"}],"url":"https://streams.spec.whatwg.org/#generictransformstream-transform"}, "ec878a66": {"dfnID":"ec878a66","dfnText":"RangeError","external":true,"refSections":[{"refs":[{"id":"ref-for-exceptiondef-rangeerror"},{"id":"ref-for-exceptiondef-rangeerror\u2460"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-exceptiondef-rangeerror\u2461"},{"id":"ref-for-exceptiondef-rangeerror\u2462"}],"title":"7.5. Interface TextDecoderStream"}],"url":"https://webidl.spec.whatwg.org/#exceptiondef-rangeerror"}, "ecf251b4": {"dfnID":"ecf251b4","dfnText":"scalar value","external":true,"refSections":[{"refs":[{"id":"ref-for-scalar-value"}],"title":"3. Terminology"},{"refs":[{"id":"ref-for-scalar-value\u2460"}],"title":"4. Encodings"}],"url":"https://infra.spec.whatwg.org/#scalar-value"}, "encode": {"dfnID":"encode","dfnText":"encode","external":false,"refSections":[{"refs":[{"id":"ref-for-encode"},{"id":"ref-for-encode\u2460"},{"id":"ref-for-encode\u2461"}],"title":"6. Hooks for standards"},{"refs":[{"id":"ref-for-encode\u2462"},{"id":"ref-for-encode\u2463"}],"title":"6.1. Legacy hooks for standards"}],"url":"#encode"}, "encode-and-enqueue-a-chunk": {"dfnID":"encode-and-enqueue-a-chunk","dfnText":"encode and enqueue a chunk","external":false,"refSections":[{"refs":[{"id":"ref-for-encode-and-enqueue-a-chunk"}],"title":"7.6. Interface TextEncoderStream"}],"url":"#encode-and-enqueue-a-chunk"}, "encode-and-flush": {"dfnID":"encode-and-flush","dfnText":"encode and flush","external":false,"refSections":[{"refs":[{"id":"ref-for-encode-and-flush"}],"title":"7.6. Interface TextEncoderStream"}],"url":"#encode-and-flush"}, "encode-or-fail": {"dfnID":"encode-or-fail","dfnText":"encode or fail","external":false,"refSections":[{"refs":[{"id":"ref-for-encode-or-fail"},{"id":"ref-for-encode-or-fail\u2460"}],"title":"6.1. Legacy hooks for standards"}],"url":"#encode-or-fail"}, "encoder": {"dfnID":"encoder","dfnText":"encoder","external":false,"refSections":[{"refs":[{"id":"ref-for-encoder"},{"id":"ref-for-encoder\u2460"},{"id":"ref-for-encoder\u2461"},{"id":"ref-for-encoder\u2462"},{"id":"ref-for-encoder\u2463"},{"id":"ref-for-encoder\u2464"},{"id":"ref-for-encoder\u2465"},{"id":"ref-for-encoder\u2466"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-encoder\u2467"}],"title":"5. Indexes"},{"refs":[{"id":"ref-for-encoder\u2468"},{"id":"ref-for-encoder\u2460\u24ea"},{"id":"ref-for-encoder\u2460\u2460"},{"id":"ref-for-encoder\u2460\u2461"}],"title":"6.1. Legacy hooks for standards"},{"refs":[{"id":"ref-for-encoder\u2460\u2462"},{"id":"ref-for-encoder\u2460\u2463"}],"title":"7.4. Interface TextEncoder"},{"refs":[{"id":"ref-for-encoder\u2460\u2464"},{"id":"ref-for-encoder\u2460\u2465"},{"id":"ref-for-encoder\u2460\u2466"}],"title":"7.6. Interface TextEncoderStream"},{"refs":[{"id":"ref-for-encoder\u2460\u2467"}],"title":"8.1.2. UTF-8 encoder"},{"refs":[{"id":"ref-for-encoder\u2460\u2468"}],"title":"9. Legacy single-byte encodings"},{"refs":[{"id":"ref-for-encoder\u2461\u24ea"}],"title":"9.2. single-byte encoder"},{"refs":[{"id":"ref-for-encoder\u2461\u2460"},{"id":"ref-for-encoder\u2461\u2461"},{"id":"ref-for-encoder\u2461\u2462"}],"title":"10.1.2. GBK encoder"},{"refs":[{"id":"ref-for-encoder\u2461\u2463"},{"id":"ref-for-encoder\u2461\u2464"}],"title":"10.2.2. gb18030 encoder"},{"refs":[{"id":"ref-for-encoder\u2461\u2465"}],"title":"11.1.2. Big5 encoder"},{"refs":[{"id":"ref-for-encoder\u2461\u2466"}],"title":"12.1.2. EUC-JP encoder"},{"refs":[{"id":"ref-for-encoder\u2461\u2467"},{"id":"ref-for-encoder\u2461\u2468"},{"id":"ref-for-encoder\u2462\u24ea"}],"title":"12.2.2. ISO-2022-JP encoder"},{"refs":[{"id":"ref-for-encoder\u2462\u2460"}],"title":"12.3.2. Shift_JIS encoder"},{"refs":[{"id":"ref-for-encoder\u2462\u2461"}],"title":"13.1.2. EUC-KR encoder"},{"refs":[{"id":"ref-for-encoder\u2462\u2462"}],"title":"14.5.2. x-user-defined encoder"},{"refs":[{"id":"ref-for-encoder\u2462\u2463"}],"title":"Implementation considerations"}],"url":"#encoder"}, "encoding": {"dfnID":"encoding","dfnText":"encoding","external":false,"refSections":[{"refs":[{"id":"ref-for-encoding"},{"id":"ref-for-encoding\u2460"},{"id":"ref-for-encoding\u2461"},{"id":"ref-for-encoding\u2462"}],"title":"4. Encodings"},{"refs":[{"id":"ref-for-encoding\u2463"},{"id":"ref-for-encoding\u2464"},{"id":"ref-for-encoding\u2465"},{"id":"ref-for-encoding\u2466"},{"id":"ref-for-encoding\u2467"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-encoding\u2468"},{"id":"ref-for-encoding\u2460\u24ea"},{"id":"ref-for-encoding\u2460\u2460"},{"id":"ref-for-encoding\u2460\u2461"},{"id":"ref-for-encoding\u2460\u2462"},{"id":"ref-for-encoding\u2460\u2463"},{"id":"ref-for-encoding\u2460\u2464"},{"id":"ref-for-encoding\u2460\u2465"},{"id":"ref-for-encoding\u2460\u2466"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-encoding\u2460\u2467"}],"title":"4.3. Output encodings"},{"refs":[{"id":"ref-for-encoding\u2460\u2468"},{"id":"ref-for-encoding\u2461\u24ea"}],"title":"5. Indexes"},{"refs":[{"id":"ref-for-encoding\u2461\u2460"},{"id":"ref-for-encoding\u2461\u2461"},{"id":"ref-for-encoding\u2461\u2462"},{"id":"ref-for-encoding\u2461\u2463"},{"id":"ref-for-encoding\u2461\u2464"}],"title":"6.1. Legacy hooks for standards"},{"refs":[{"id":"ref-for-encoding\u2461\u2465"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-encoding\u2461\u2466"},{"id":"ref-for-encoding\u2461\u2467"}],"title":"9. Legacy single-byte encodings"},{"refs":[{"id":"ref-for-encoding\u2461\u2468"},{"id":"ref-for-encoding\u2462\u24ea"}],"title":"14.1. replacement"},{"refs":[{"id":"ref-for-encoding\u2462\u2460"},{"id":"ref-for-encoding\u2462\u2461"}],"title":"Implementation considerations"}],"url":"#encoding"}, "end-of-stream": {"dfnID":"end-of-stream","dfnText":"End-of-queue","external":false,"refSections":[{"refs":[{"id":"ref-for-end-of-stream"}],"title":"2. Security background"},{"refs":[{"id":"ref-for-end-of-stream\u2460"},{"id":"ref-for-end-of-stream\u2461"},{"id":"ref-for-end-of-stream\u2462"},{"id":"ref-for-end-of-stream\u2463"},{"id":"ref-for-end-of-stream\u2464"},{"id":"ref-for-end-of-stream\u2465"},{"id":"ref-for-end-of-stream\u2466"},{"id":"ref-for-end-of-stream\u2467"},{"id":"ref-for-end-of-stream\u2468"},{"id":"ref-for-end-of-stream\u2460\u24ea"},{"id":"ref-for-end-of-stream\u2460\u2460"},{"id":"ref-for-end-of-stream\u2460\u2461"},{"id":"ref-for-end-of-stream\u2460\u2462"},{"id":"ref-for-end-of-stream\u2460\u2463"},{"id":"ref-for-end-of-stream\u2460\u2464"}],"title":"3. Terminology"},{"refs":[{"id":"ref-for-end-of-stream\u2460\u2465"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-end-of-stream\u2460\u2466"}],"title":"6. Hooks for standards"},{"refs":[{"id":"ref-for-end-of-stream\u2460\u2467"}],"title":"6.1. Legacy hooks for standards"},{"refs":[{"id":"ref-for-end-of-stream\u2460\u2468"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-end-of-stream\u2461\u24ea"},{"id":"ref-for-end-of-stream\u2461\u2460"},{"id":"ref-for-end-of-stream\u2461\u2461"},{"id":"ref-for-end-of-stream\u2461\u2462"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-end-of-stream\u2461\u2463"},{"id":"ref-for-end-of-stream\u2461\u2464"}],"title":"7.4. Interface TextEncoder"},{"refs":[{"id":"ref-for-end-of-stream\u2461\u2465"},{"id":"ref-for-end-of-stream\u2461\u2466"},{"id":"ref-for-end-of-stream\u2461\u2467"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-end-of-stream\u2461\u2468"},{"id":"ref-for-end-of-stream\u2462\u24ea"}],"title":"7.6. Interface TextEncoderStream"},{"refs":[{"id":"ref-for-end-of-stream\u2462\u2460"},{"id":"ref-for-end-of-stream\u2462\u2461"}],"title":"8.1.1. UTF-8 decoder"},{"refs":[{"id":"ref-for-end-of-stream\u2462\u2462"}],"title":"8.1.2. UTF-8 encoder"},{"refs":[{"id":"ref-for-end-of-stream\u2462\u2463"}],"title":"9.1. single-byte decoder"},{"refs":[{"id":"ref-for-end-of-stream\u2462\u2464"}],"title":"9.2. single-byte encoder"},{"refs":[{"id":"ref-for-end-of-stream\u2462\u2465"},{"id":"ref-for-end-of-stream\u2462\u2466"}],"title":"10.2.1. gb18030 decoder"},{"refs":[{"id":"ref-for-end-of-stream\u2462\u2467"}],"title":"10.2.2. gb18030 encoder"},{"refs":[{"id":"ref-for-end-of-stream\u2462\u2468"},{"id":"ref-for-end-of-stream\u2463\u24ea"}],"title":"11.1.1. Big5 decoder"},{"refs":[{"id":"ref-for-end-of-stream\u2463\u2460"}],"title":"11.1.2. Big5 encoder"},{"refs":[{"id":"ref-for-end-of-stream\u2463\u2461"},{"id":"ref-for-end-of-stream\u2463\u2462"}],"title":"12.1.1. EUC-JP decoder"},{"refs":[{"id":"ref-for-end-of-stream\u2463\u2463"}],"title":"12.1.2. EUC-JP encoder"},{"refs":[{"id":"ref-for-end-of-stream\u2463\u2464"},{"id":"ref-for-end-of-stream\u2463\u2465"},{"id":"ref-for-end-of-stream\u2463\u2466"},{"id":"ref-for-end-of-stream\u2463\u2467"},{"id":"ref-for-end-of-stream\u2463\u2468"},{"id":"ref-for-end-of-stream\u2464\u24ea"},{"id":"ref-for-end-of-stream\u2464\u2460"}],"title":"12.2.1. ISO-2022-JP decoder"},{"refs":[{"id":"ref-for-end-of-stream\u2464\u2461"},{"id":"ref-for-end-of-stream\u2464\u2462"}],"title":"12.2.2. ISO-2022-JP encoder"},{"refs":[{"id":"ref-for-end-of-stream\u2464\u2463"},{"id":"ref-for-end-of-stream\u2464\u2464"}],"title":"12.3.1. Shift_JIS decoder"},{"refs":[{"id":"ref-for-end-of-stream\u2464\u2465"}],"title":"12.3.2. Shift_JIS encoder"},{"refs":[{"id":"ref-for-end-of-stream\u2464\u2466"},{"id":"ref-for-end-of-stream\u2464\u2467"}],"title":"13.1.1. EUC-KR decoder"},{"refs":[{"id":"ref-for-end-of-stream\u2464\u2468"}],"title":"13.1.2. EUC-KR encoder"},{"refs":[{"id":"ref-for-end-of-stream\u2465\u24ea"}],"title":"14.1.1. replacement decoder"},{"refs":[{"id":"ref-for-end-of-stream\u2465\u2460"},{"id":"ref-for-end-of-stream\u2465\u2461"}],"title":"14.2.1. shared UTF-16 decoder"},{"refs":[{"id":"ref-for-end-of-stream\u2465\u2462"}],"title":"14.5.1. x-user-defined decoder"},{"refs":[{"id":"ref-for-end-of-stream\u2465\u2463"}],"title":"14.5.2. x-user-defined encoder"}],"url":"#end-of-stream"}, "error": {"dfnID":"error","dfnText":"error","external":false,"refSections":[{"refs":[{"id":"ref-for-error"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-error\u2460"}],"title":"6. Hooks for standards"},{"refs":[{"id":"ref-for-error\u2461"},{"id":"ref-for-error\u2462"},{"id":"ref-for-error\u2463"},{"id":"ref-for-error\u2464"},{"id":"ref-for-error\u2465"},{"id":"ref-for-error\u2466"}],"title":"6.1. Legacy hooks for standards"},{"refs":[{"id":"ref-for-error\u2467"},{"id":"ref-for-error\u2468"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-error\u2460\u24ea"},{"id":"ref-for-error\u2460\u2460"}],"title":"7.4. Interface TextEncoder"},{"refs":[{"id":"ref-for-error\u2460\u2461"},{"id":"ref-for-error\u2460\u2462"},{"id":"ref-for-error\u2460\u2463"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-error\u2460\u2464"},{"id":"ref-for-error\u2460\u2465"},{"id":"ref-for-error\u2460\u2466"}],"title":"8.1.1. UTF-8 decoder"},{"refs":[{"id":"ref-for-error\u2460\u2467"}],"title":"9.1. single-byte decoder"},{"refs":[{"id":"ref-for-error\u2460\u2468"}],"title":"9.2. single-byte encoder"},{"refs":[{"id":"ref-for-error\u2461\u24ea"},{"id":"ref-for-error\u2461\u2460"},{"id":"ref-for-error\u2461\u2461"},{"id":"ref-for-error\u2461\u2462"},{"id":"ref-for-error\u2461\u2463"},{"id":"ref-for-error\u2461\u2464"}],"title":"10.2.1. gb18030 decoder"},{"refs":[{"id":"ref-for-error\u2461\u2465"},{"id":"ref-for-error\u2461\u2466"}],"title":"10.2.2. gb18030 encoder"},{"refs":[{"id":"ref-for-error\u2461\u2467"},{"id":"ref-for-error\u2461\u2468"},{"id":"ref-for-error\u2462\u24ea"}],"title":"11.1.1. Big5 decoder"},{"refs":[{"id":"ref-for-error\u2462\u2460"}],"title":"11.1.2. Big5 encoder"},{"refs":[{"id":"ref-for-error\u2462\u2461"},{"id":"ref-for-error\u2462\u2462"},{"id":"ref-for-error\u2462\u2463"}],"title":"12.1.1. EUC-JP decoder"},{"refs":[{"id":"ref-for-error\u2462\u2464"}],"title":"12.1.2. EUC-JP encoder"},{"refs":[{"id":"ref-for-error\u2462\u2465"},{"id":"ref-for-error\u2462\u2466"},{"id":"ref-for-error\u2462\u2467"},{"id":"ref-for-error\u2462\u2468"},{"id":"ref-for-error\u2463\u24ea"},{"id":"ref-for-error\u2463\u2460"},{"id":"ref-for-error\u2463\u2461"},{"id":"ref-for-error\u2463\u2462"},{"id":"ref-for-error\u2463\u2463"},{"id":"ref-for-error\u2463\u2464"},{"id":"ref-for-error\u2463\u2465"}],"title":"12.2.1. ISO-2022-JP decoder"},{"refs":[{"id":"ref-for-error\u2463\u2466"},{"id":"ref-for-error\u2463\u2467"},{"id":"ref-for-error\u2463\u2468"}],"title":"12.2.2. ISO-2022-JP encoder"},{"refs":[{"id":"ref-for-error\u2464\u24ea"},{"id":"ref-for-error\u2464\u2460"},{"id":"ref-for-error\u2464\u2461"}],"title":"12.3.1. Shift_JIS decoder"},{"refs":[{"id":"ref-for-error\u2464\u2462"}],"title":"12.3.2. Shift_JIS encoder"},{"refs":[{"id":"ref-for-error\u2464\u2463"},{"id":"ref-for-error\u2464\u2464"},{"id":"ref-for-error\u2464\u2465"}],"title":"13.1.1. EUC-KR decoder"},{"refs":[{"id":"ref-for-error\u2464\u2466"}],"title":"13.1.2. EUC-KR encoder"},{"refs":[{"id":"ref-for-error\u2464\u2467"}],"title":"14.1.1. replacement decoder"},{"refs":[{"id":"ref-for-error\u2464\u2468"},{"id":"ref-for-error\u2465\u24ea"},{"id":"ref-for-error\u2465\u2460"}],"title":"14.2.1. shared UTF-16 decoder"},{"refs":[{"id":"ref-for-error\u2465\u2461"}],"title":"14.5.2. x-user-defined encoder"}],"url":"#error"}, "error-mode": {"dfnID":"error-mode","dfnText":"error mode","external":false,"refSections":[{"refs":[{"id":"ref-for-error-mode"},{"id":"ref-for-error-mode\u2460"},{"id":"ref-for-error-mode\u2461"},{"id":"ref-for-error-mode\u2462"},{"id":"ref-for-error-mode\u2463"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-error-mode\u2464"}],"title":"7.1. Interface mixin TextDecoderCommon"}],"url":"#error-mode"}, "euc-jp": {"dfnID":"euc-jp","dfnText":"12.1. EUC-JP","external":false,"refSections":[{"refs":[{"id":"ref-for-euc-jp"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-euc-jp"}],"title":"12.1. EUC-JP"},{"refs":[{"id":"ref-for-euc-jp\u2460"},{"id":"ref-for-euc-jp\u2461"}],"title":"12.1.1. EUC-JP decoder"},{"refs":[{"id":"ref-for-euc-jp\u2462"}],"title":"12.1.2. EUC-JP encoder"}],"url":"#euc-jp"}, "euc-jp-decoder": {"dfnID":"euc-jp-decoder","dfnText":"12.1.1. EUC-JP decoder","external":false,"refSections":[{"refs":[{"id":"ref-for-euc-jp-decoder"}],"title":"5. Indexes"},{"refs":[{"id":"ref-for-euc-jp-decoder"}],"title":"12.1.1. EUC-JP decoder"}],"url":"#euc-jp-decoder"}, "euc-jp-encoder": {"dfnID":"euc-jp-encoder","dfnText":"12.1.2. EUC-JP encoder","external":false,"refSections":[{"refs":[{"id":"ref-for-euc-jp-encoder"}],"title":"12.1.2. EUC-JP encoder"}],"url":"#euc-jp-encoder"}, "euc-jp-jis0212-flag": {"dfnID":"euc-jp-jis0212-flag","dfnText":"EUC-JP jis0212","external":false,"refSections":[{"refs":[{"id":"ref-for-euc-jp-jis0212-flag"},{"id":"ref-for-euc-jp-jis0212-flag\u2460"},{"id":"ref-for-euc-jp-jis0212-flag\u2461"}],"title":"12.1.1. EUC-JP decoder"}],"url":"#euc-jp-jis0212-flag"}, "euc-jp-lead": {"dfnID":"euc-jp-lead","dfnText":"EUC-JP lead","external":false,"refSections":[{"refs":[{"id":"ref-for-euc-jp-lead"},{"id":"ref-for-euc-jp-lead\u2460"},{"id":"ref-for-euc-jp-lead\u2461"},{"id":"ref-for-euc-jp-lead\u2462"},{"id":"ref-for-euc-jp-lead\u2463"},{"id":"ref-for-euc-jp-lead\u2464"},{"id":"ref-for-euc-jp-lead\u2465"},{"id":"ref-for-euc-jp-lead\u2466"},{"id":"ref-for-euc-jp-lead\u2467"},{"id":"ref-for-euc-jp-lead\u2468"},{"id":"ref-for-euc-jp-lead\u2460\u24ea"}],"title":"12.1.1. EUC-JP decoder"}],"url":"#euc-jp-lead"}, "euc-kr": {"dfnID":"euc-kr","dfnText":"13.1. EUC-KR","external":false,"refSections":[{"refs":[{"id":"ref-for-euc-kr"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-euc-kr"}],"title":"13.1. EUC-KR"},{"refs":[{"id":"ref-for-euc-kr\u2460"},{"id":"ref-for-euc-kr\u2461"}],"title":"13.1.1. EUC-KR decoder"},{"refs":[{"id":"ref-for-euc-kr\u2462"}],"title":"13.1.2. EUC-KR encoder"}],"url":"#euc-kr"}, "euc-kr-decoder": {"dfnID":"euc-kr-decoder","dfnText":"13.1.1. EUC-KR decoder","external":false,"refSections":[{"refs":[{"id":"ref-for-euc-kr-decoder"}],"title":"13.1.1. EUC-KR decoder"}],"url":"#euc-kr-decoder"}, "euc-kr-encoder": {"dfnID":"euc-kr-encoder","dfnText":"13.1.2. EUC-KR encoder","external":false,"refSections":[{"refs":[{"id":"ref-for-euc-kr-encoder"}],"title":"13.1.2. EUC-KR encoder"}],"url":"#euc-kr-encoder"}, "euc-kr-lead": {"dfnID":"euc-kr-lead","dfnText":"EUC-KR lead","external":false,"refSections":[{"refs":[{"id":"ref-for-euc-kr-lead"},{"id":"ref-for-euc-kr-lead\u2460"},{"id":"ref-for-euc-kr-lead\u2461"},{"id":"ref-for-euc-kr-lead\u2462"},{"id":"ref-for-euc-kr-lead\u2463"},{"id":"ref-for-euc-kr-lead\u2464"},{"id":"ref-for-euc-kr-lead\u2465"}],"title":"13.1.1. EUC-KR decoder"}],"url":"#euc-kr-lead"}, "f14b47b8": {"dfnID":"f14b47b8","dfnText":"unsigned long long","external":true,"refSections":[{"refs":[{"id":"ref-for-idl-unsigned-long-long"},{"id":"ref-for-idl-unsigned-long-long\u2460"}],"title":"7.4. Interface TextEncoder"}],"url":"https://webidl.spec.whatwg.org/#idl-unsigned-long-long"}, "f3fd9d04": {"dfnID":"f3fd9d04","dfnText":"write","external":true,"refSections":[{"refs":[{"id":"ref-for-arraybufferview-write"}],"title":"7.4. Interface TextEncoder"}],"url":"https://webidl.spec.whatwg.org/#arraybufferview-write"}, "f5354b9d": {"dfnID":"f5354b9d","dfnText":"byte","external":true,"refSections":[{"refs":[{"id":"ref-for-byte"}],"title":"3. Terminology"},{"refs":[{"id":"ref-for-byte\u2460"}],"title":"4. Encodings"}],"url":"https://infra.spec.whatwg.org/#byte"}, "f937b7b6": {"dfnID":"f937b7b6","dfnText":"continue","external":true,"refSections":[{"refs":[{"id":"ref-for-iteration-continue"}],"title":"7.1. Interface mixin TextDecoderCommon"}],"url":"https://infra.spec.whatwg.org/#iteration-continue"}, "febebe0e": {"dfnID":"febebe0e","dfnText":"the range","external":true,"refSections":[{"refs":[{"id":"ref-for-the-range"}],"title":"3. Terminology"}],"url":"https://infra.spec.whatwg.org/#the-range"}, "finished": {"dfnID":"finished","dfnText":"finished","external":false,"refSections":[{"refs":[{"id":"ref-for-finished"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-finished\u2460"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-finished\u2461"},{"id":"ref-for-finished\u2462"}],"title":"7.4. Interface TextEncoder"},{"refs":[{"id":"ref-for-finished\u2463"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-finished\u2464"}],"title":"8.1.1. UTF-8 decoder"},{"refs":[{"id":"ref-for-finished\u2465"}],"title":"8.1.2. UTF-8 encoder"},{"refs":[{"id":"ref-for-finished\u2466"}],"title":"9.1. single-byte decoder"},{"refs":[{"id":"ref-for-finished\u2467"}],"title":"9.2. single-byte encoder"},{"refs":[{"id":"ref-for-finished\u2468"}],"title":"10.2.1. gb18030 decoder"},{"refs":[{"id":"ref-for-finished\u2460\u24ea"}],"title":"10.2.2. gb18030 encoder"},{"refs":[{"id":"ref-for-finished\u2460\u2460"}],"title":"11.1.1. Big5 decoder"},{"refs":[{"id":"ref-for-finished\u2460\u2461"}],"title":"11.1.2. Big5 encoder"},{"refs":[{"id":"ref-for-finished\u2460\u2462"}],"title":"12.1.1. EUC-JP decoder"},{"refs":[{"id":"ref-for-finished\u2460\u2463"}],"title":"12.1.2. EUC-JP encoder"},{"refs":[{"id":"ref-for-finished\u2460\u2464"},{"id":"ref-for-finished\u2460\u2465"},{"id":"ref-for-finished\u2460\u2466"},{"id":"ref-for-finished\u2460\u2467"}],"title":"12.2.1. ISO-2022-JP decoder"},{"refs":[{"id":"ref-for-finished\u2460\u2468"}],"title":"12.2.2. ISO-2022-JP encoder"},{"refs":[{"id":"ref-for-finished\u2461\u24ea"}],"title":"12.3.1. Shift_JIS decoder"},{"refs":[{"id":"ref-for-finished\u2461\u2460"}],"title":"12.3.2. Shift_JIS encoder"},{"refs":[{"id":"ref-for-finished\u2461\u2461"}],"title":"13.1.1. EUC-KR decoder"},{"refs":[{"id":"ref-for-finished\u2461\u2462"}],"title":"13.1.2. EUC-KR encoder"},{"refs":[{"id":"ref-for-finished\u2461\u2463"},{"id":"ref-for-finished\u2461\u2464"}],"title":"14.1.1. replacement decoder"},{"refs":[{"id":"ref-for-finished\u2461\u2465"}],"title":"14.2.1. shared UTF-16 decoder"},{"refs":[{"id":"ref-for-finished\u2461\u2466"}],"title":"14.5.1. x-user-defined decoder"},{"refs":[{"id":"ref-for-finished\u2461\u2467"}],"title":"14.5.2. x-user-defined encoder"}],"url":"#finished"}, "flush-and-enqueue": {"dfnID":"flush-and-enqueue","dfnText":"flush and enqueue","external":false,"refSections":[{"refs":[{"id":"ref-for-flush-and-enqueue"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#flush-and-enqueue"}, "from-i-o-queue-convert": {"dfnID":"from-i-o-queue-convert","dfnText":"convert","external":false,"refSections":[{"refs":[{"id":"ref-for-from-i-o-queue-convert"}],"title":"7.4. Interface TextEncoder"},{"refs":[{"id":"ref-for-from-i-o-queue-convert\u2460"}],"title":"7.6. Interface TextEncoderStream"}],"url":"#from-i-o-queue-convert"}, "gb18030": {"dfnID":"gb18030","dfnText":"10.2. gb18030","external":false,"refSections":[{"refs":[{"id":"ref-for-gb18030"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-gb18030\u2460"}],"title":"10.1.1. GBK decoder"},{"refs":[{"id":"ref-for-gb18030\u2461"},{"id":"ref-for-gb18030\u2462"}],"title":"10.1.2. GBK encoder"},{"refs":[{"id":"ref-for-gb18030"}],"title":"10.2. gb18030"},{"refs":[{"id":"ref-for-gb18030\u2463"},{"id":"ref-for-gb18030\u2464"}],"title":"10.2.1. gb18030 decoder"},{"refs":[{"id":"ref-for-gb18030\u2465"},{"id":"ref-for-gb18030\u2466"}],"title":"10.2.2. gb18030 encoder"},{"refs":[{"id":"ref-for-gb18030\u2467"},{"id":"ref-for-gb18030\u2468"},{"id":"ref-for-gb18030\u2460\u24ea"}],"title":"Implementation considerations"}],"url":"#gb18030"}, "gb18030-decoder": {"dfnID":"gb18030-decoder","dfnText":"10.2.1. gb18030 decoder","external":false,"refSections":[{"refs":[{"id":"ref-for-gb18030-decoder"}],"title":"2. Security background"},{"refs":[{"id":"ref-for-gb18030-decoder"}],"title":"10.2.1. gb18030 decoder"}],"url":"#gb18030-decoder"}, "gb18030-encoder": {"dfnID":"gb18030-encoder","dfnText":"10.2.2. gb18030 encoder","external":false,"refSections":[{"refs":[{"id":"ref-for-gb18030-encoder"}],"title":"5. Indexes"},{"refs":[{"id":"ref-for-gb18030-encoder"}],"title":"10.2.2. gb18030 encoder"}],"url":"#gb18030-encoder"}, "gb18030-first": {"dfnID":"gb18030-first","dfnText":"gb18030 first","external":false,"refSections":[{"refs":[{"id":"ref-for-gb18030-first"},{"id":"ref-for-gb18030-first\u2460"},{"id":"ref-for-gb18030-first\u2461"},{"id":"ref-for-gb18030-first\u2462"},{"id":"ref-for-gb18030-first\u2463"},{"id":"ref-for-gb18030-first\u2464"},{"id":"ref-for-gb18030-first\u2465"},{"id":"ref-for-gb18030-first\u2466"},{"id":"ref-for-gb18030-first\u2467"},{"id":"ref-for-gb18030-first\u2468"},{"id":"ref-for-gb18030-first\u2460\u24ea"}],"title":"10.2.1. gb18030 decoder"},{"refs":[{"id":"ref-for-gb18030-first\u2460\u2460"}],"title":"Implementation considerations"}],"url":"#gb18030-first"}, "gb18030-second": {"dfnID":"gb18030-second","dfnText":"gb18030 second","external":false,"refSections":[{"refs":[{"id":"ref-for-gb18030-second"},{"id":"ref-for-gb18030-second\u2460"},{"id":"ref-for-gb18030-second\u2461"},{"id":"ref-for-gb18030-second\u2462"},{"id":"ref-for-gb18030-second\u2463"},{"id":"ref-for-gb18030-second\u2464"},{"id":"ref-for-gb18030-second\u2465"},{"id":"ref-for-gb18030-second\u2466"},{"id":"ref-for-gb18030-second\u2467"},{"id":"ref-for-gb18030-second\u2468"},{"id":"ref-for-gb18030-second\u2460\u24ea"}],"title":"10.2.1. gb18030 decoder"},{"refs":[{"id":"ref-for-gb18030-second\u2460\u2460"}],"title":"Implementation considerations"}],"url":"#gb18030-second"}, "gb18030-third": {"dfnID":"gb18030-third","dfnText":"gb18030 third","external":false,"refSections":[{"refs":[{"id":"ref-for-gb18030-third"},{"id":"ref-for-gb18030-third\u2460"},{"id":"ref-for-gb18030-third\u2461"},{"id":"ref-for-gb18030-third\u2462"},{"id":"ref-for-gb18030-third\u2463"},{"id":"ref-for-gb18030-third\u2464"},{"id":"ref-for-gb18030-third\u2465"},{"id":"ref-for-gb18030-third\u2466"},{"id":"ref-for-gb18030-third\u2467"}],"title":"10.2.1. gb18030 decoder"},{"refs":[{"id":"ref-for-gb18030-third\u2468"},{"id":"ref-for-gb18030-third\u2460\u24ea"}],"title":"Implementation considerations"}],"url":"#gb18030-third"}, "gbk": {"dfnID":"gbk","dfnText":"10.1. GBK","external":false,"refSections":[{"refs":[{"id":"ref-for-gbk"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-gbk"}],"title":"10.1. GBK"},{"refs":[{"id":"ref-for-gbk\u2460"}],"title":"10.1.1. GBK decoder"},{"refs":[{"id":"ref-for-gbk\u2461"},{"id":"ref-for-gbk\u2462"},{"id":"ref-for-gbk\u2463"}],"title":"10.1.2. GBK encoder"}],"url":"#gbk"}, "gbk-decoder": {"dfnID":"gbk-decoder","dfnText":"10.1.1. GBK decoder","external":false,"refSections":[{"refs":[{"id":"ref-for-gbk-decoder"}],"title":"10.1.1. GBK decoder"}],"url":"#gbk-decoder"}, "gbk-encoder": {"dfnID":"gbk-encoder","dfnText":"10.1.2. GBK encoder","external":false,"refSections":[{"refs":[{"id":"ref-for-gbk-encoder"}],"title":"10.1.2. GBK encoder"}],"url":"#gbk-encoder"}, "gbk-flag": {"dfnID":"gbk-flag","dfnText":"is GBK","external":false,"refSections":[{"refs":[{"id":"ref-for-gbk-flag"}],"title":"10.1.2. GBK encoder"},{"refs":[{"id":"ref-for-gbk-flag\u2460"},{"id":"ref-for-gbk-flag\u2461"}],"title":"10.2.2. gb18030 encoder"}],"url":"#gbk-flag"}, "get-an-encoder": {"dfnID":"get-an-encoder","dfnText":"get an encoder","external":false,"refSections":[{"refs":[{"id":"ref-for-get-an-encoder"},{"id":"ref-for-get-an-encoder\u2460"}],"title":"6.1. Legacy hooks for standards"}],"url":"#get-an-encoder"}, "get-an-output-encoding": {"dfnID":"get-an-output-encoding","dfnText":"get an output encoding","external":false,"refSections":[{"refs":[{"id":"ref-for-get-an-output-encoding"}],"title":"4.3. Output encodings"},{"refs":[{"id":"ref-for-get-an-output-encoding\u2460"}],"title":"6.1. Legacy hooks for standards"}],"url":"#get-an-output-encoding"}, "handler": {"dfnID":"handler","dfnText":"handler","external":false,"refSections":[{"refs":[{"id":"ref-for-handler"},{"id":"ref-for-handler\u2460"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-handler\u2461"},{"id":"ref-for-handler\u2462"}],"title":"7.4. Interface TextEncoder"},{"refs":[{"id":"ref-for-handler\u2463"}],"title":"8.1.1. UTF-8 decoder"},{"refs":[{"id":"ref-for-handler\u2464"}],"title":"8.1.2. UTF-8 encoder"},{"refs":[{"id":"ref-for-handler\u2465"}],"title":"9.1. single-byte decoder"},{"refs":[{"id":"ref-for-handler\u2466"}],"title":"9.2. single-byte encoder"},{"refs":[{"id":"ref-for-handler\u2467"}],"title":"10.2.1. gb18030 decoder"},{"refs":[{"id":"ref-for-handler\u2468"}],"title":"10.2.2. gb18030 encoder"},{"refs":[{"id":"ref-for-handler\u2460\u24ea"}],"title":"11.1.1. Big5 decoder"},{"refs":[{"id":"ref-for-handler\u2460\u2460"}],"title":"11.1.2. Big5 encoder"},{"refs":[{"id":"ref-for-handler\u2460\u2461"}],"title":"12.1.1. EUC-JP decoder"},{"refs":[{"id":"ref-for-handler\u2460\u2462"}],"title":"12.1.2. EUC-JP encoder"},{"refs":[{"id":"ref-for-handler\u2460\u2463"}],"title":"12.2.1. ISO-2022-JP decoder"},{"refs":[{"id":"ref-for-handler\u2460\u2464"}],"title":"12.2.2. ISO-2022-JP encoder"},{"refs":[{"id":"ref-for-handler\u2460\u2465"}],"title":"12.3.1. Shift_JIS decoder"},{"refs":[{"id":"ref-for-handler\u2460\u2466"}],"title":"12.3.2. Shift_JIS encoder"},{"refs":[{"id":"ref-for-handler\u2460\u2467"}],"title":"13.1.1. EUC-KR decoder"},{"refs":[{"id":"ref-for-handler\u2460\u2468"}],"title":"13.1.2. EUC-KR encoder"},{"refs":[{"id":"ref-for-handler\u2461\u24ea"}],"title":"14.1.1. replacement decoder"},{"refs":[{"id":"ref-for-handler\u2461\u2460"}],"title":"14.2.1. shared UTF-16 decoder"},{"refs":[{"id":"ref-for-handler\u2461\u2461"}],"title":"14.5.1. x-user-defined decoder"},{"refs":[{"id":"ref-for-handler\u2461\u2462"}],"title":"14.5.2. x-user-defined encoder"}],"url":"#handler"}, "i-o-queue-peek": {"dfnID":"i-o-queue-peek","dfnText":"peek","external":false,"refSections":[{"refs":[{"id":"ref-for-i-o-queue-peek"}],"title":"6. Hooks for standards"},{"refs":[{"id":"ref-for-i-o-queue-peek\u2460"}],"title":"6.1. Legacy hooks for standards"}],"url":"#i-o-queue-peek"}, "ibm866": {"dfnID":"ibm866","dfnText":"IBM866","external":false,"refSections":[{"refs":[{"id":"ref-for-ibm866"},{"id":"ref-for-ibm866\u2460"}],"title":"4.2. Names and labels"}],"url":"#ibm866"}, "index": {"dfnID":"index","dfnText":"index","external":false,"refSections":[{"refs":[{"id":"ref-for-index"},{"id":"ref-for-index\u2460"},{"id":"ref-for-index\u2461"},{"id":"ref-for-index\u2462"},{"id":"ref-for-index\u2463"},{"id":"ref-for-index\u2464"},{"id":"ref-for-index\u2465"},{"id":"ref-for-index\u2466"},{"id":"ref-for-index\u2467"},{"id":"ref-for-index\u2468"},{"id":"ref-for-index\u2460\u24ea"}],"title":"5. Indexes"},{"refs":[{"id":"ref-for-index\u2460\u2460"}],"title":"9. Legacy single-byte encodings"},{"refs":[{"id":"ref-for-index\u2460\u2461"}],"title":"11.1.1. Big5 decoder"}],"url":"#index"}, "index-big5": {"dfnID":"index-big5","dfnText":"index Big5","external":false,"refSections":[{"refs":[{"id":"ref-for-index-big5"}],"title":"5. Indexes"},{"refs":[{"id":"ref-for-index-big5\u2460"}],"title":"11.1.1. Big5 decoder"}],"url":"#index-big5"}, "index-big5-pointer": {"dfnID":"index-big5-pointer","dfnText":"index Big5 pointer","external":false,"refSections":[{"refs":[{"id":"ref-for-index-big5-pointer"}],"title":"11.1.2. Big5 encoder"}],"url":"#index-big5-pointer"}, "index-code-point": {"dfnID":"index-code-point","dfnText":"index code point","external":false,"refSections":[{"refs":[{"id":"ref-for-index-code-point"}],"title":"9.1. single-byte decoder"},{"refs":[{"id":"ref-for-index-code-point\u2460"}],"title":"10.2.1. gb18030 decoder"},{"refs":[{"id":"ref-for-index-code-point\u2461"}],"title":"11.1.1. Big5 decoder"},{"refs":[{"id":"ref-for-index-code-point\u2462"}],"title":"12.1.1. EUC-JP decoder"},{"refs":[{"id":"ref-for-index-code-point\u2463"}],"title":"12.2.1. ISO-2022-JP decoder"},{"refs":[{"id":"ref-for-index-code-point\u2464"}],"title":"12.2.2. ISO-2022-JP encoder"},{"refs":[{"id":"ref-for-index-code-point\u2465"}],"title":"12.3.1. Shift_JIS decoder"},{"refs":[{"id":"ref-for-index-code-point\u2466"}],"title":"13.1.1. EUC-KR decoder"}],"url":"#index-code-point"}, "index-euc-kr": {"dfnID":"index-euc-kr","dfnText":"index EUC-KR","external":false,"refSections":[{"refs":[{"id":"ref-for-index-euc-kr"}],"title":"13.1.1. EUC-KR decoder"},{"refs":[{"id":"ref-for-index-euc-kr\u2460"}],"title":"13.1.2. EUC-KR encoder"}],"url":"#index-euc-kr"}, "index-gb18030": {"dfnID":"index-gb18030","dfnText":"index gb18030","external":false,"refSections":[{"refs":[{"id":"ref-for-index-gb18030"}],"title":"10.2.1. gb18030 decoder"},{"refs":[{"id":"ref-for-index-gb18030\u2460"},{"id":"ref-for-index-gb18030\u2461"}],"title":"10.2.2. gb18030 encoder"}],"url":"#index-gb18030"}, "index-gb18030-ranges": {"dfnID":"index-gb18030-ranges","dfnText":"index gb18030 ranges","external":false,"refSections":[{"refs":[{"id":"ref-for-index-gb18030-ranges"},{"id":"ref-for-index-gb18030-ranges\u2460"},{"id":"ref-for-index-gb18030-ranges\u2461"},{"id":"ref-for-index-gb18030-ranges\u2462"},{"id":"ref-for-index-gb18030-ranges\u2463"}],"title":"5. Indexes"},{"refs":[{"id":"ref-for-index-gb18030-ranges\u2464"}],"title":"10.2.2. gb18030 encoder"}],"url":"#index-gb18030-ranges"}, "index-gb18030-ranges-code-point": {"dfnID":"index-gb18030-ranges-code-point","dfnText":"index gb18030 ranges code point","external":false,"refSections":[{"refs":[{"id":"ref-for-index-gb18030-ranges-code-point"}],"title":"5. Indexes"},{"refs":[{"id":"ref-for-index-gb18030-ranges-code-point\u2460"}],"title":"10.2.1. gb18030 decoder"}],"url":"#index-gb18030-ranges-code-point"}, "index-gb18030-ranges-pointer": {"dfnID":"index-gb18030-ranges-pointer","dfnText":"index gb18030 ranges pointer","external":false,"refSections":[{"refs":[{"id":"ref-for-index-gb18030-ranges-pointer"}],"title":"5. Indexes"},{"refs":[{"id":"ref-for-index-gb18030-ranges-pointer\u2460"}],"title":"10.2.2. gb18030 encoder"}],"url":"#index-gb18030-ranges-pointer"}, "index-iso-2022-jp-katakana": {"dfnID":"index-iso-2022-jp-katakana","dfnText":"index ISO-2022-JP katakana","external":false,"refSections":[{"refs":[{"id":"ref-for-index-iso-2022-jp-katakana"},{"id":"ref-for-index-iso-2022-jp-katakana\u2460"}],"title":"5. Indexes"},{"refs":[{"id":"ref-for-index-iso-2022-jp-katakana\u2461"}],"title":"12.2.2. ISO-2022-JP encoder"}],"url":"#index-iso-2022-jp-katakana"}, "index-jis0208": {"dfnID":"index-jis0208","dfnText":"index jis0208","external":false,"refSections":[{"refs":[{"id":"ref-for-index-jis0208"},{"id":"ref-for-index-jis0208\u2460"},{"id":"ref-for-index-jis0208\u2461"}],"title":"5. Indexes"},{"refs":[{"id":"ref-for-index-jis0208\u2462"}],"title":"12.1.1. EUC-JP decoder"},{"refs":[{"id":"ref-for-index-jis0208\u2463"},{"id":"ref-for-index-jis0208\u2464"}],"title":"12.1.2. EUC-JP encoder"},{"refs":[{"id":"ref-for-index-jis0208\u2465"}],"title":"12.2.1. ISO-2022-JP decoder"},{"refs":[{"id":"ref-for-index-jis0208\u2466"},{"id":"ref-for-index-jis0208\u2467"}],"title":"12.2.2. ISO-2022-JP encoder"},{"refs":[{"id":"ref-for-index-jis0208\u2468"}],"title":"12.3.1. Shift_JIS decoder"}],"url":"#index-jis0208"}, "index-jis0212": {"dfnID":"index-jis0212","dfnText":"index jis0212","external":false,"refSections":[{"refs":[{"id":"ref-for-index-jis0212"}],"title":"12.1.1. EUC-JP decoder"}],"url":"#index-jis0212"}, "index-pointer": {"dfnID":"index-pointer","dfnText":"index pointer","external":false,"refSections":[{"refs":[{"id":"ref-for-index-pointer"},{"id":"ref-for-index-pointer\u2460"}],"title":"5. Indexes"},{"refs":[{"id":"ref-for-index-pointer\u2461"}],"title":"9.2. single-byte encoder"},{"refs":[{"id":"ref-for-index-pointer\u2462"}],"title":"10.2.2. gb18030 encoder"},{"refs":[{"id":"ref-for-index-pointer\u2463"},{"id":"ref-for-index-pointer\u2464"}],"title":"12.1.2. EUC-JP encoder"},{"refs":[{"id":"ref-for-index-pointer\u2465"},{"id":"ref-for-index-pointer\u2466"}],"title":"12.2.2. ISO-2022-JP encoder"},{"refs":[{"id":"ref-for-index-pointer\u2467"}],"title":"13.1.2. EUC-KR encoder"}],"url":"#index-pointer"}, "index-shift_jis-pointer": {"dfnID":"index-shift_jis-pointer","dfnText":"index Shift_JIS pointer","external":false,"refSections":[{"refs":[{"id":"ref-for-index-shift_jis-pointer"}],"title":"12.3.2. Shift_JIS encoder"}],"url":"#index-shift_jis-pointer"}, "index-single-byte": {"dfnID":"index-single-byte","dfnText":"Index single-byte","external":false,"refSections":[{"refs":[{"id":"ref-for-index-single-byte"}],"title":"5. Indexes"},{"refs":[{"id":"ref-for-index-single-byte\u2460"}],"title":"9.1. single-byte decoder"},{"refs":[{"id":"ref-for-index-single-byte\u2461"}],"title":"9.2. single-byte encoder"}],"url":"#index-single-byte"}, "iso-2022-jp": {"dfnID":"iso-2022-jp","dfnText":"12.2. ISO-2022-JP","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-2022-jp"}],"title":"2. Security background"},{"refs":[{"id":"ref-for-iso-2022-jp\u2460"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-iso-2022-jp"}],"title":"12.2. ISO-2022-JP"},{"refs":[{"id":"ref-for-iso-2022-jp\u2461"},{"id":"ref-for-iso-2022-jp\u2462"}],"title":"12.2.1. ISO-2022-JP decoder"},{"refs":[{"id":"ref-for-iso-2022-jp\u2463"},{"id":"ref-for-iso-2022-jp\u2464"}],"title":"12.2.2. ISO-2022-JP encoder"},{"refs":[{"id":"ref-for-iso-2022-jp\u2465"}],"title":"Implementation considerations"}],"url":"#iso-2022-jp"}, "iso-2022-jp-decoder": {"dfnID":"iso-2022-jp-decoder","dfnText":"12.2.1. ISO-2022-JP decoder","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-2022-jp-decoder"}],"title":"12.2.1. ISO-2022-JP decoder"}],"url":"#iso-2022-jp-decoder"}, "iso-2022-jp-decoder-ascii": {"dfnID":"iso-2022-jp-decoder-ascii","dfnText":"ASCII","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-2022-jp-decoder-ascii"},{"id":"ref-for-iso-2022-jp-decoder-ascii\u2460"},{"id":"ref-for-iso-2022-jp-decoder-ascii\u2461"}],"title":"12.2.1. ISO-2022-JP decoder"}],"url":"#iso-2022-jp-decoder-ascii"}, "iso-2022-jp-decoder-escape": {"dfnID":"iso-2022-jp-decoder-escape","dfnText":"Escape","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-2022-jp-decoder-escape"}],"title":"12.2.1. ISO-2022-JP decoder"}],"url":"#iso-2022-jp-decoder-escape"}, "iso-2022-jp-decoder-escape-start": {"dfnID":"iso-2022-jp-decoder-escape-start","dfnText":"Escape start","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-2022-jp-decoder-escape-start"},{"id":"ref-for-iso-2022-jp-decoder-escape-start\u2460"},{"id":"ref-for-iso-2022-jp-decoder-escape-start\u2461"},{"id":"ref-for-iso-2022-jp-decoder-escape-start\u2462"},{"id":"ref-for-iso-2022-jp-decoder-escape-start\u2463"}],"title":"12.2.1. ISO-2022-JP decoder"}],"url":"#iso-2022-jp-decoder-escape-start"}, "iso-2022-jp-decoder-katakana": {"dfnID":"iso-2022-jp-decoder-katakana","dfnText":"katakana","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-2022-jp-decoder-katakana"}],"title":"12.2.1. ISO-2022-JP decoder"}],"url":"#iso-2022-jp-decoder-katakana"}, "iso-2022-jp-decoder-lead-byte": {"dfnID":"iso-2022-jp-decoder-lead-byte","dfnText":"Lead byte","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-2022-jp-decoder-lead-byte"},{"id":"ref-for-iso-2022-jp-decoder-lead-byte\u2460"},{"id":"ref-for-iso-2022-jp-decoder-lead-byte\u2461"},{"id":"ref-for-iso-2022-jp-decoder-lead-byte\u2462"}],"title":"12.2.1. ISO-2022-JP decoder"}],"url":"#iso-2022-jp-decoder-lead-byte"}, "iso-2022-jp-decoder-output-state": {"dfnID":"iso-2022-jp-decoder-output-state","dfnText":"ISO-2022-JP decoder output state","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-2022-jp-decoder-output-state"},{"id":"ref-for-iso-2022-jp-decoder-output-state\u2460"},{"id":"ref-for-iso-2022-jp-decoder-output-state\u2461"}],"title":"12.2.1. ISO-2022-JP decoder"}],"url":"#iso-2022-jp-decoder-output-state"}, "iso-2022-jp-decoder-roman": {"dfnID":"iso-2022-jp-decoder-roman","dfnText":"Roman","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-2022-jp-decoder-roman"}],"title":"6.1. Legacy hooks for standards"},{"refs":[{"id":"ref-for-iso-2022-jp-decoder-roman\u2460"}],"title":"12.2.1. ISO-2022-JP decoder"}],"url":"#iso-2022-jp-decoder-roman"}, "iso-2022-jp-decoder-state": {"dfnID":"iso-2022-jp-decoder-state","dfnText":"ISO-2022-JP decoder state","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-2022-jp-decoder-state"},{"id":"ref-for-iso-2022-jp-decoder-state\u2460"},{"id":"ref-for-iso-2022-jp-decoder-state\u2461"},{"id":"ref-for-iso-2022-jp-decoder-state\u2462"},{"id":"ref-for-iso-2022-jp-decoder-state\u2463"},{"id":"ref-for-iso-2022-jp-decoder-state\u2464"},{"id":"ref-for-iso-2022-jp-decoder-state\u2465"},{"id":"ref-for-iso-2022-jp-decoder-state\u2466"},{"id":"ref-for-iso-2022-jp-decoder-state\u2467"},{"id":"ref-for-iso-2022-jp-decoder-state\u2468"},{"id":"ref-for-iso-2022-jp-decoder-state\u2460\u24ea"},{"id":"ref-for-iso-2022-jp-decoder-state\u2460\u2460"},{"id":"ref-for-iso-2022-jp-decoder-state\u2460\u2461"},{"id":"ref-for-iso-2022-jp-decoder-state\u2460\u2462"}],"title":"12.2.1. ISO-2022-JP decoder"}],"url":"#iso-2022-jp-decoder-state"}, "iso-2022-jp-decoder-trail-byte": {"dfnID":"iso-2022-jp-decoder-trail-byte","dfnText":"Trail byte","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-2022-jp-decoder-trail-byte"}],"title":"12.2.1. ISO-2022-JP decoder"}],"url":"#iso-2022-jp-decoder-trail-byte"}, "iso-2022-jp-encoder": {"dfnID":"iso-2022-jp-encoder","dfnText":"12.2.2. ISO-2022-JP encoder","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-2022-jp-encoder"}],"title":"5. Indexes"},{"refs":[{"id":"ref-for-iso-2022-jp-encoder\u2460"},{"id":"ref-for-iso-2022-jp-encoder\u2461"},{"id":"ref-for-iso-2022-jp-encoder\u2462"}],"title":"6.1. Legacy hooks for standards"},{"refs":[{"id":"ref-for-iso-2022-jp-encoder"},{"id":"ref-for-iso-2022-jp-encoder\u2463"}],"title":"12.2.2. ISO-2022-JP encoder"},{"refs":[{"id":"ref-for-iso-2022-jp-encoder\u2464"}],"title":"Implementation considerations"}],"url":"#iso-2022-jp-encoder"}, "iso-2022-jp-encoder-ascii": {"dfnID":"iso-2022-jp-encoder-ascii","dfnText":"ASCII","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-2022-jp-encoder-ascii"},{"id":"ref-for-iso-2022-jp-encoder-ascii\u2460"},{"id":"ref-for-iso-2022-jp-encoder-ascii\u2461"},{"id":"ref-for-iso-2022-jp-encoder-ascii\u2462"},{"id":"ref-for-iso-2022-jp-encoder-ascii\u2463"},{"id":"ref-for-iso-2022-jp-encoder-ascii\u2464"},{"id":"ref-for-iso-2022-jp-encoder-ascii\u2465"},{"id":"ref-for-iso-2022-jp-encoder-ascii\u2466"},{"id":"ref-for-iso-2022-jp-encoder-ascii\u2467"}],"title":"12.2.2. ISO-2022-JP encoder"}],"url":"#iso-2022-jp-encoder-ascii"}, "iso-2022-jp-encoder-jis0208": {"dfnID":"iso-2022-jp-encoder-jis0208","dfnText":"jis0208","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-2022-jp-encoder-jis0208"},{"id":"ref-for-iso-2022-jp-encoder-jis0208\u2460"},{"id":"ref-for-iso-2022-jp-encoder-jis0208\u2461"}],"title":"12.2.2. ISO-2022-JP encoder"}],"url":"#iso-2022-jp-encoder-jis0208"}, "iso-2022-jp-encoder-roman": {"dfnID":"iso-2022-jp-encoder-roman","dfnText":"Roman","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-2022-jp-encoder-roman"},{"id":"ref-for-iso-2022-jp-encoder-roman\u2460"},{"id":"ref-for-iso-2022-jp-encoder-roman\u2461"},{"id":"ref-for-iso-2022-jp-encoder-roman\u2462"}],"title":"12.2.2. ISO-2022-JP encoder"}],"url":"#iso-2022-jp-encoder-roman"}, "iso-2022-jp-encoder-state": {"dfnID":"iso-2022-jp-encoder-state","dfnText":"ISO-2022-JP encoder state","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-2022-jp-encoder-state"},{"id":"ref-for-iso-2022-jp-encoder-state\u2460"},{"id":"ref-for-iso-2022-jp-encoder-state\u2461"},{"id":"ref-for-iso-2022-jp-encoder-state\u2462"},{"id":"ref-for-iso-2022-jp-encoder-state\u2463"},{"id":"ref-for-iso-2022-jp-encoder-state\u2464"},{"id":"ref-for-iso-2022-jp-encoder-state\u2465"},{"id":"ref-for-iso-2022-jp-encoder-state\u2466"},{"id":"ref-for-iso-2022-jp-encoder-state\u2467"},{"id":"ref-for-iso-2022-jp-encoder-state\u2468"},{"id":"ref-for-iso-2022-jp-encoder-state\u2460\u24ea"},{"id":"ref-for-iso-2022-jp-encoder-state\u2460\u2460"},{"id":"ref-for-iso-2022-jp-encoder-state\u2460\u2461"},{"id":"ref-for-iso-2022-jp-encoder-state\u2460\u2462"}],"title":"12.2.2. ISO-2022-JP encoder"},{"refs":[{"id":"ref-for-iso-2022-jp-encoder-state\u2460\u2463"}],"title":"Implementation considerations"}],"url":"#iso-2022-jp-encoder-state"}, "iso-2022-jp-lead": {"dfnID":"iso-2022-jp-lead","dfnText":"ISO-2022-JP lead","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-2022-jp-lead"},{"id":"ref-for-iso-2022-jp-lead\u2460"},{"id":"ref-for-iso-2022-jp-lead\u2461"},{"id":"ref-for-iso-2022-jp-lead\u2462"},{"id":"ref-for-iso-2022-jp-lead\u2463"}],"title":"12.2.1. ISO-2022-JP decoder"}],"url":"#iso-2022-jp-lead"}, "iso-2022-jp-output-flag": {"dfnID":"iso-2022-jp-output-flag","dfnText":"ISO-2022-JP output","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-2022-jp-output-flag"},{"id":"ref-for-iso-2022-jp-output-flag\u2460"},{"id":"ref-for-iso-2022-jp-output-flag\u2461"},{"id":"ref-for-iso-2022-jp-output-flag\u2462"},{"id":"ref-for-iso-2022-jp-output-flag\u2463"},{"id":"ref-for-iso-2022-jp-output-flag\u2464"},{"id":"ref-for-iso-2022-jp-output-flag\u2465"},{"id":"ref-for-iso-2022-jp-output-flag\u2466"},{"id":"ref-for-iso-2022-jp-output-flag\u2467"},{"id":"ref-for-iso-2022-jp-output-flag\u2468"},{"id":"ref-for-iso-2022-jp-output-flag\u2460\u24ea"},{"id":"ref-for-iso-2022-jp-output-flag\u2460\u2460"},{"id":"ref-for-iso-2022-jp-output-flag\u2460\u2461"},{"id":"ref-for-iso-2022-jp-output-flag\u2460\u2462"}],"title":"12.2.1. ISO-2022-JP decoder"}],"url":"#iso-2022-jp-output-flag"}, "iso-8859-10": {"dfnID":"iso-8859-10","dfnText":"ISO-8859-10","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-8859-10"},{"id":"ref-for-iso-8859-10\u2460"}],"title":"4.2. Names and labels"}],"url":"#iso-8859-10"}, "iso-8859-13": {"dfnID":"iso-8859-13","dfnText":"ISO-8859-13","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-8859-13"}],"title":"4.2. Names and labels"}],"url":"#iso-8859-13"}, "iso-8859-14": {"dfnID":"iso-8859-14","dfnText":"ISO-8859-14","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-8859-14"},{"id":"ref-for-iso-8859-14\u2460"}],"title":"4.2. Names and labels"}],"url":"#iso-8859-14"}, "iso-8859-15": {"dfnID":"iso-8859-15","dfnText":"ISO-8859-15","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-8859-15"}],"title":"4.2. Names and labels"}],"url":"#iso-8859-15"}, "iso-8859-16": {"dfnID":"iso-8859-16","dfnText":"ISO-8859-16","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-8859-16"},{"id":"ref-for-iso-8859-16\u2460"}],"title":"4.2. Names and labels"}],"url":"#iso-8859-16"}, "iso-8859-2": {"dfnID":"iso-8859-2","dfnText":"ISO-8859-2","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-8859-2"}],"title":"4.2. Names and labels"}],"url":"#iso-8859-2"}, "iso-8859-3": {"dfnID":"iso-8859-3","dfnText":"ISO-8859-3","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-8859-3"},{"id":"ref-for-iso-8859-3\u2460"}],"title":"4.2. Names and labels"}],"url":"#iso-8859-3"}, "iso-8859-4": {"dfnID":"iso-8859-4","dfnText":"ISO-8859-4","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-8859-4"}],"title":"4.2. Names and labels"}],"url":"#iso-8859-4"}, "iso-8859-5": {"dfnID":"iso-8859-5","dfnText":"ISO-8859-5","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-8859-5"}],"title":"4.2. Names and labels"}],"url":"#iso-8859-5"}, "iso-8859-6": {"dfnID":"iso-8859-6","dfnText":"ISO-8859-6","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-8859-6"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-iso-8859-6\u2460"}],"title":"9. Legacy single-byte encodings"}],"url":"#iso-8859-6"}, "iso-8859-7": {"dfnID":"iso-8859-7","dfnText":"ISO-8859-7","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-8859-7"}],"title":"4.2. Names and labels"}],"url":"#iso-8859-7"}, "iso-8859-8": {"dfnID":"iso-8859-8","dfnText":"ISO-8859-8","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-8859-8"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-iso-8859-8\u2460"},{"id":"ref-for-iso-8859-8\u2461"}],"title":"9. Legacy single-byte encodings"}],"url":"#iso-8859-8"}, "iso-8859-8-i": {"dfnID":"iso-8859-8-i","dfnText":"ISO-8859-8-I","external":false,"refSections":[{"refs":[{"id":"ref-for-iso-8859-8-i"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-iso-8859-8-i\u2460"}],"title":"9. Legacy single-byte encodings"}],"url":"#iso-8859-8-i"}, "koi8-r": {"dfnID":"koi8-r","dfnText":"KOI8-R","external":false,"refSections":[{"refs":[{"id":"ref-for-koi8-r"}],"title":"4.2. Names and labels"}],"url":"#koi8-r"}, "koi8-u": {"dfnID":"koi8-u","dfnText":"KOI8-U","external":false,"refSections":[{"refs":[{"id":"ref-for-koi8-u"}],"title":"4.2. Names and labels"}],"url":"#koi8-u"}, "label": {"dfnID":"label","dfnText":"labels","external":false,"refSections":[{"refs":[{"id":"ref-for-label"},{"id":"ref-for-label\u2460"},{"id":"ref-for-label\u2461"},{"id":"ref-for-label\u2462"},{"id":"ref-for-label\u2463"},{"id":"ref-for-label\u2464"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-label\u2465"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-label\u2466"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-label\u2467"}],"title":"14.4. UTF-16LE"}],"url":"#label"}, "macintosh": {"dfnID":"macintosh","dfnText":"macintosh","external":false,"refSections":[{"refs":[{"id":"ref-for-macintosh"},{"id":"ref-for-macintosh\u2460"}],"title":"4.2. Names and labels"}],"url":"#macintosh"}, "name": {"dfnID":"name","dfnText":"name","external":false,"refSections":[{"refs":[{"id":"ref-for-name"},{"id":"ref-for-name\u2460"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-name\u2461"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-name\u2462"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-name\u2463"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-name\u2464"}],"title":"9. Legacy single-byte encodings"}],"url":"#name"}, "replacement": {"dfnID":"replacement","dfnText":"14.1. replacement","external":false,"refSections":[{"refs":[{"id":"ref-for-replacement"}],"title":"2. Security background"},{"refs":[{"id":"ref-for-replacement\u2460"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-replacement\u2461"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-replacement\u2462"}],"title":"4.3. Output encodings"},{"refs":[{"id":"ref-for-replacement\u2463"}],"title":"6.1. Legacy hooks for standards"},{"refs":[{"id":"ref-for-replacement\u2464"},{"id":"ref-for-replacement\u2465"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-replacement\u2466"},{"id":"ref-for-replacement\u2467"}],"title":"7.5. Interface TextDecoderStream"},{"refs":[{"id":"ref-for-replacement"},{"id":"ref-for-replacement\u2468"}],"title":"14.1. replacement"},{"refs":[{"id":"ref-for-replacement\u2460\u24ea"},{"id":"ref-for-replacement\u2460\u2460"}],"title":"14.1.1. replacement decoder"}],"url":"#replacement"}, "replacement-decoder": {"dfnID":"replacement-decoder","dfnText":"14.1.1. replacement decoder","external":false,"refSections":[{"refs":[{"id":"ref-for-replacement-decoder"}],"title":"14.1.1. replacement decoder"}],"url":"#replacement-decoder"}, "replacement-error-returned-flag": {"dfnID":"replacement-error-returned-flag","dfnText":"replacement error returned","external":false,"refSections":[{"refs":[{"id":"ref-for-replacement-error-returned-flag"},{"id":"ref-for-replacement-error-returned-flag\u2460"}],"title":"14.1.1. replacement decoder"}],"url":"#replacement-error-returned-flag"}, "scalar-value-from-surrogates": {"dfnID":"scalar-value-from-surrogates","dfnText":"scalar value from surrogates","external":false,"refSections":[{"refs":[{"id":"ref-for-scalar-value-from-surrogates"}],"title":"7.6. Interface TextEncoderStream"},{"refs":[{"id":"ref-for-scalar-value-from-surrogates\u2460"}],"title":"14.2.1. shared UTF-16 decoder"}],"url":"#scalar-value-from-surrogates"}, "shared-utf-16-decoder": {"dfnID":"shared-utf-16-decoder","dfnText":"14.2.1. shared UTF-16 decoder","external":false,"refSections":[{"refs":[{"id":"ref-for-shared-utf-16-decoder"},{"id":"ref-for-shared-utf-16-decoder"},{"id":"ref-for-shared-utf-16-decoder\u2460"},{"id":"ref-for-shared-utf-16-decoder\u2461"}],"title":"14.2.1. shared UTF-16 decoder"},{"refs":[{"id":"ref-for-shared-utf-16-decoder\u2462"}],"title":"14.3.1. UTF-16BE decoder"},{"refs":[{"id":"ref-for-shared-utf-16-decoder\u2463"}],"title":"14.4.1. UTF-16LE decoder"}],"url":"#shared-utf-16-decoder"}, "shift_jis": {"dfnID":"shift_jis","dfnText":"12.3. Shift_JIS","external":false,"refSections":[{"refs":[{"id":"ref-for-shift_jis"}],"title":"2. Security background"},{"refs":[{"id":"ref-for-shift_jis\u2460"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-shift_jis\u2461"}],"title":"5. Indexes"},{"refs":[{"id":"ref-for-shift_jis"}],"title":"12.3. Shift_JIS"},{"refs":[{"id":"ref-for-shift_jis\u2462"},{"id":"ref-for-shift_jis\u2463"}],"title":"12.3.1. Shift_JIS decoder"},{"refs":[{"id":"ref-for-shift_jis\u2464"}],"title":"12.3.2. Shift_JIS encoder"}],"url":"#shift_jis"}, "shift_jis-decoder": {"dfnID":"shift_jis-decoder","dfnText":"12.3.1. Shift_JIS decoder","external":false,"refSections":[{"refs":[{"id":"ref-for-shift_jis-decoder"}],"title":"12.3.1. Shift_JIS decoder"}],"url":"#shift_jis-decoder"}, "shift_jis-encoder": {"dfnID":"shift_jis-encoder","dfnText":"12.3.2. Shift_JIS encoder","external":false,"refSections":[{"refs":[{"id":"ref-for-shift_jis-encoder"}],"title":"12.3.2. Shift_JIS encoder"}],"url":"#shift_jis-encoder"}, "shift_jis-lead": {"dfnID":"shift_jis-lead","dfnText":"Shift_JIS lead","external":false,"refSections":[{"refs":[{"id":"ref-for-shift_jis-lead"},{"id":"ref-for-shift_jis-lead\u2460"},{"id":"ref-for-shift_jis-lead\u2461"},{"id":"ref-for-shift_jis-lead\u2462"},{"id":"ref-for-shift_jis-lead\u2463"},{"id":"ref-for-shift_jis-lead\u2464"},{"id":"ref-for-shift_jis-lead\u2465"}],"title":"12.3.1. Shift_JIS decoder"}],"url":"#shift_jis-lead"}, "single-byte-decoder": {"dfnID":"single-byte-decoder","dfnText":"9.1. single-byte decoder","external":false,"refSections":[{"refs":[{"id":"ref-for-single-byte-decoder"}],"title":"9. Legacy single-byte encodings"},{"refs":[{"id":"ref-for-single-byte-decoder"}],"title":"9.1. single-byte decoder"}],"url":"#single-byte-decoder"}, "single-byte-encoder": {"dfnID":"single-byte-encoder","dfnText":"9.2. single-byte encoder","external":false,"refSections":[{"refs":[{"id":"ref-for-single-byte-encoder"}],"title":"9. Legacy single-byte encodings"},{"refs":[{"id":"ref-for-single-byte-encoder"}],"title":"9.2. single-byte encoder"}],"url":"#single-byte-encoder"}, "single-byte-encoding": {"dfnID":"single-byte-encoding","dfnText":"single-byte encoding","external":false,"refSections":[{"refs":[{"id":"ref-for-single-byte-encoding"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-single-byte-encoding\u2460"},{"id":"ref-for-single-byte-encoding\u2461"},{"id":"ref-for-single-byte-encoding\u2462"}],"title":"9. Legacy single-byte encodings"},{"refs":[{"id":"ref-for-single-byte-encoding\u2463"}],"title":"9.1. single-byte decoder"},{"refs":[{"id":"ref-for-single-byte-encoding\u2464"}],"title":"9.2. single-byte encoder"},{"refs":[{"id":"ref-for-single-byte-encoding\u2465"}],"title":"14.5. x-user-defined"}],"url":"#single-byte-encoding"}, "textdecodeoptions": {"dfnID":"textdecodeoptions","dfnText":"TextDecodeOptions","external":false,"refSections":[{"refs":[{"id":"ref-for-textdecodeoptions"}],"title":"7.2. Interface TextDecoder"}],"url":"#textdecodeoptions"}, "textdecoder": {"dfnID":"textdecoder","dfnText":"TextDecoder","external":false,"refSections":[{"refs":[{"id":"ref-for-textdecoder"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-textdecoder\u2460"},{"id":"ref-for-textdecoder\u2461"},{"id":"ref-for-textdecoder\u2462"},{"id":"ref-for-textdecoder\u2463"}],"title":"7.2. Interface TextDecoder"}],"url":"#textdecoder"}, "textdecoder-bom-seen-flag": {"dfnID":"textdecoder-bom-seen-flag","dfnText":"BOM seen","external":false,"refSections":[{"refs":[{"id":"ref-for-textdecoder-bom-seen-flag"},{"id":"ref-for-textdecoder-bom-seen-flag\u2460"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-textdecoder-bom-seen-flag\u2461"}],"title":"7.2. Interface TextDecoder"}],"url":"#textdecoder-bom-seen-flag"}, "textdecoder-do-not-flush-flag": {"dfnID":"textdecoder-do-not-flush-flag","dfnText":"do not flush","external":false,"refSections":[{"refs":[{"id":"ref-for-textdecoder-do-not-flush-flag"},{"id":"ref-for-textdecoder-do-not-flush-flag\u2460"},{"id":"ref-for-textdecoder-do-not-flush-flag\u2461"},{"id":"ref-for-textdecoder-do-not-flush-flag\u2462"}],"title":"7.2. Interface TextDecoder"}],"url":"#textdecoder-do-not-flush-flag"}, "textdecoder-encoding": {"dfnID":"textdecoder-encoding","dfnText":"encoding","external":false,"refSections":[{"refs":[{"id":"ref-for-textdecoder-encoding"},{"id":"ref-for-textdecoder-encoding\u2460"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-textdecoder-encoding\u2461"},{"id":"ref-for-textdecoder-encoding\u2462"},{"id":"ref-for-textdecoder-encoding\u2463"},{"id":"ref-for-textdecoder-encoding\u2464"},{"id":"ref-for-textdecoder-encoding\u2465"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-textdecoder-encoding\u2466"},{"id":"ref-for-textdecoder-encoding\u2467"},{"id":"ref-for-textdecoder-encoding\u2468"},{"id":"ref-for-textdecoder-encoding\u2460\u24ea"},{"id":"ref-for-textdecoder-encoding\u2460\u2460"},{"id":"ref-for-textdecoder-encoding\u2460\u2461"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#textdecoder-encoding"}, "textdecoder-error-mode": {"dfnID":"textdecoder-error-mode","dfnText":"error mode","external":false,"refSections":[{"refs":[{"id":"ref-for-textdecoder-error-mode"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-textdecoder-error-mode\u2460"},{"id":"ref-for-textdecoder-error-mode\u2461"},{"id":"ref-for-textdecoder-error-mode\u2462"},{"id":"ref-for-textdecoder-error-mode\u2463"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-textdecoder-error-mode\u2464"},{"id":"ref-for-textdecoder-error-mode\u2465"},{"id":"ref-for-textdecoder-error-mode\u2466"},{"id":"ref-for-textdecoder-error-mode\u2467"},{"id":"ref-for-textdecoder-error-mode\u2468"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#textdecoder-error-mode"}, "textdecoder-ignore-bom-flag": {"dfnID":"textdecoder-ignore-bom-flag","dfnText":"ignore BOM","external":false,"refSections":[{"refs":[{"id":"ref-for-textdecoder-ignore-bom-flag"},{"id":"ref-for-textdecoder-ignore-bom-flag\u2460"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-textdecoder-ignore-bom-flag\u2461"},{"id":"ref-for-textdecoder-ignore-bom-flag\u2462"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-textdecoder-ignore-bom-flag\u2463"},{"id":"ref-for-textdecoder-ignore-bom-flag\u2464"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#textdecoder-ignore-bom-flag"}, "textdecodercommon": {"dfnID":"textdecodercommon","dfnText":"TextDecoderCommon","external":false,"refSections":[{"refs":[{"id":"ref-for-textdecodercommon"},{"id":"ref-for-textdecodercommon\u2460"},{"id":"ref-for-textdecodercommon\u2461"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-textdecodercommon\u2462"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-textdecodercommon\u2463"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#textdecodercommon"}, "textdecodercommon-decoder": {"dfnID":"textdecodercommon-decoder","dfnText":"decoder","external":false,"refSections":[{"refs":[{"id":"ref-for-textdecodercommon-decoder"},{"id":"ref-for-textdecodercommon-decoder\u2460"},{"id":"ref-for-textdecodercommon-decoder\u2461"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-textdecodercommon-decoder\u2462"},{"id":"ref-for-textdecodercommon-decoder\u2463"},{"id":"ref-for-textdecodercommon-decoder\u2464"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#textdecodercommon-decoder"}, "textdecodercommon-i-o-queue": {"dfnID":"textdecodercommon-i-o-queue","dfnText":"I/O queue","external":false,"refSections":[{"refs":[{"id":"ref-for-textdecodercommon-i-o-queue"},{"id":"ref-for-textdecodercommon-i-o-queue\u2460"},{"id":"ref-for-textdecodercommon-i-o-queue\u2461"},{"id":"ref-for-textdecodercommon-i-o-queue\u2462"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-textdecodercommon-i-o-queue\u2463"},{"id":"ref-for-textdecodercommon-i-o-queue\u2464"},{"id":"ref-for-textdecodercommon-i-o-queue\u2465"},{"id":"ref-for-textdecodercommon-i-o-queue\u2466"},{"id":"ref-for-textdecodercommon-i-o-queue\u2467"},{"id":"ref-for-textdecodercommon-i-o-queue\u2468"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#textdecodercommon-i-o-queue"}, "textdecoderoptions": {"dfnID":"textdecoderoptions","dfnText":"TextDecoderOptions","external":false,"refSections":[{"refs":[{"id":"ref-for-textdecoderoptions"}],"title":"7.2. Interface TextDecoder"},{"refs":[{"id":"ref-for-textdecoderoptions\u2460"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#textdecoderoptions"}, "textdecoderstream": {"dfnID":"textdecoderstream","dfnText":"TextDecoderStream","external":false,"refSections":[{"refs":[{"id":"ref-for-textdecoderstream"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-textdecoderstream\u2460"},{"id":"ref-for-textdecoderstream\u2461"},{"id":"ref-for-textdecoderstream\u2462"},{"id":"ref-for-textdecoderstream\u2463"},{"id":"ref-for-textdecoderstream\u2464"},{"id":"ref-for-textdecoderstream\u2465"}],"title":"7.5. Interface TextDecoderStream"}],"url":"#textdecoderstream"}, "textencoder": {"dfnID":"textencoder","dfnText":"TextEncoder","external":false,"refSections":[{"refs":[{"id":"ref-for-textencoder"}],"title":"7. API"},{"refs":[{"id":"ref-for-textencoder\u2460"}],"title":"7.3. Interface mixin TextEncoderCommon"},{"refs":[{"id":"ref-for-textencoder\u2461"},{"id":"ref-for-textencoder\u2462"},{"id":"ref-for-textencoder\u2463"},{"id":"ref-for-textencoder\u2464"}],"title":"7.4. Interface TextEncoder"}],"url":"#textencoder"}, "textencodercommon": {"dfnID":"textencodercommon","dfnText":"TextEncoderCommon","external":false,"refSections":[{"refs":[{"id":"ref-for-textencodercommon"},{"id":"ref-for-textencodercommon\u2460"}],"title":"7.3. Interface mixin TextEncoderCommon"},{"refs":[{"id":"ref-for-textencodercommon\u2461"}],"title":"7.4. Interface TextEncoder"},{"refs":[{"id":"ref-for-textencodercommon\u2462"}],"title":"7.6. Interface TextEncoderStream"}],"url":"#textencodercommon"}, "textencoderstream": {"dfnID":"textencoderstream","dfnText":"TextEncoderStream","external":false,"refSections":[{"refs":[{"id":"ref-for-textencoderstream"}],"title":"7.3. Interface mixin TextEncoderCommon"},{"refs":[{"id":"ref-for-textencoderstream\u2460"},{"id":"ref-for-textencoderstream\u2461"},{"id":"ref-for-textencoderstream\u2462"},{"id":"ref-for-textencoderstream\u2463"},{"id":"ref-for-textencoderstream\u2464"},{"id":"ref-for-textencoderstream\u2465"},{"id":"ref-for-textencoderstream\u2466"},{"id":"ref-for-textencoderstream\u2467"},{"id":"ref-for-textencoderstream\u2468"}],"title":"7.6. Interface TextEncoderStream"}],"url":"#textencoderstream"}, "textencoderstream-encoder": {"dfnID":"textencoderstream-encoder","dfnText":"encoder","external":false,"refSections":[{"refs":[{"id":"ref-for-textencoderstream-encoder"},{"id":"ref-for-textencoderstream-encoder\u2460"}],"title":"7.6. Interface TextEncoderStream"}],"url":"#textencoderstream-encoder"}, "textencoderstream-pending-high-surrogate": {"dfnID":"textencoderstream-pending-high-surrogate","dfnText":"leading surrogate","external":false,"refSections":[{"refs":[{"id":"ref-for-textencoderstream-pending-high-surrogate"},{"id":"ref-for-textencoderstream-pending-high-surrogate\u2460"},{"id":"ref-for-textencoderstream-pending-high-surrogate\u2461"},{"id":"ref-for-textencoderstream-pending-high-surrogate\u2462"},{"id":"ref-for-textencoderstream-pending-high-surrogate\u2463"}],"title":"7.6. Interface TextEncoderStream"}],"url":"#textencoderstream-pending-high-surrogate"}, "to-i-o-queue-convert": {"dfnID":"to-i-o-queue-convert","dfnText":"convert","external":false,"refSections":[{"refs":[{"id":"ref-for-to-i-o-queue-convert"},{"id":"ref-for-to-i-o-queue-convert\u2460"}],"title":"7.4. Interface TextEncoder"},{"refs":[{"id":"ref-for-to-i-o-queue-convert\u2461"}],"title":"7.6. Interface TextEncoderStream"}],"url":"#to-i-o-queue-convert"}, "utf-16-lead-byte": {"dfnID":"utf-16-lead-byte","dfnText":"UTF-16 lead byte","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-16-lead-byte"},{"id":"ref-for-utf-16-lead-byte\u2460"},{"id":"ref-for-utf-16-lead-byte\u2461"},{"id":"ref-for-utf-16-lead-byte\u2462"},{"id":"ref-for-utf-16-lead-byte\u2463"},{"id":"ref-for-utf-16-lead-byte\u2464"},{"id":"ref-for-utf-16-lead-byte\u2465"},{"id":"ref-for-utf-16-lead-byte\u2466"}],"title":"14.2.1. shared UTF-16 decoder"}],"url":"#utf-16-lead-byte"}, "utf-16-lead-surrogate": {"dfnID":"utf-16-lead-surrogate","dfnText":"UTF-16 leading surrogate","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-16-lead-surrogate"},{"id":"ref-for-utf-16-lead-surrogate\u2460"},{"id":"ref-for-utf-16-lead-surrogate\u2461"},{"id":"ref-for-utf-16-lead-surrogate\u2462"},{"id":"ref-for-utf-16-lead-surrogate\u2463"},{"id":"ref-for-utf-16-lead-surrogate\u2464"},{"id":"ref-for-utf-16-lead-surrogate\u2465"}],"title":"14.2.1. shared UTF-16 decoder"}],"url":"#utf-16-lead-surrogate"}, "utf-16be": {"dfnID":"utf-16be","dfnText":"14.3. UTF-16BE","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-16be"},{"id":"ref-for-utf-16be\u2460"}],"title":"4. Encodings"},{"refs":[{"id":"ref-for-utf-16be\u2461"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-utf-16be\u2462"}],"title":"6.1. Legacy hooks for standards"},{"refs":[{"id":"ref-for-utf-16be\u2463"}],"title":"14.2. Common infrastructure for UTF-16BE/LE"},{"refs":[{"id":"ref-for-utf-16be"}],"title":"14.3. UTF-16BE"},{"refs":[{"id":"ref-for-utf-16be\u2464"}],"title":"14.3.1. UTF-16BE decoder"}],"url":"#utf-16be"}, "utf-16be-decoder": {"dfnID":"utf-16be-decoder","dfnText":"14.3.1. UTF-16BE decoder","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-16be-decoder"}],"title":"14.3.1. UTF-16BE decoder"}],"url":"#utf-16be-decoder"}, "utf-16be-decoder-flag": {"dfnID":"utf-16be-decoder-flag","dfnText":"is UTF-16BE decoder","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-16be-decoder-flag"},{"id":"ref-for-utf-16be-decoder-flag\u2460"},{"id":"ref-for-utf-16be-decoder-flag\u2461"}],"title":"14.2.1. shared UTF-16 decoder"},{"refs":[{"id":"ref-for-utf-16be-decoder-flag\u2462"}],"title":"14.3.1. UTF-16BE decoder"}],"url":"#utf-16be-decoder-flag"}, "utf-16be-le": {"dfnID":"utf-16be-le","dfnText":"UTF-16BE/LE","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-16be-le"}],"title":"2. Security background"},{"refs":[{"id":"ref-for-utf-16be-le\u2460"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-utf-16be-le\u2461"}],"title":"4.3. Output encodings"},{"refs":[{"id":"ref-for-utf-16be-le\u2462"}],"title":"6.1. Legacy hooks for standards"},{"refs":[{"id":"ref-for-utf-16be-le\u2463"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-utf-16be-le\u2464"}],"title":"14.2. Common infrastructure for UTF-16BE/LE"},{"refs":[{"id":"ref-for-utf-16be-le\u2465"},{"id":"ref-for-utf-16be-le\u2466"}],"title":"15. Browser UI"}],"url":"#utf-16be-le"}, "utf-16le": {"dfnID":"utf-16le","dfnText":"14.4. UTF-16LE","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-16le"},{"id":"ref-for-utf-16le\u2460"}],"title":"4. Encodings"},{"refs":[{"id":"ref-for-utf-16le\u2461"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-utf-16le\u2462"}],"title":"6.1. Legacy hooks for standards"},{"refs":[{"id":"ref-for-utf-16le\u2463"}],"title":"14.2. Common infrastructure for UTF-16BE/LE"},{"refs":[{"id":"ref-for-utf-16le"},{"id":"ref-for-utf-16le\u2464"}],"title":"14.4. UTF-16LE"},{"refs":[{"id":"ref-for-utf-16le\u2465"}],"title":"14.4.1. UTF-16LE decoder"}],"url":"#utf-16le"}, "utf-16le-decoder": {"dfnID":"utf-16le-decoder","dfnText":"14.4.1. UTF-16LE decoder","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-16le-decoder"}],"title":"14.4.1. UTF-16LE decoder"}],"url":"#utf-16le-decoder"}, "utf-8": {"dfnID":"utf-8","dfnText":"8.1. UTF-8","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-8"},{"id":"ref-for-utf-8\u2460"}],"title":"4. Encodings"},{"refs":[{"id":"ref-for-utf-8\u2461"}],"title":"4.1. Encoders and decoders"},{"refs":[{"id":"ref-for-utf-8\u2462"},{"id":"ref-for-utf-8\u2463"},{"id":"ref-for-utf-8\u2464"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-utf-8\u2465"}],"title":"4.3. Output encodings"},{"refs":[{"id":"ref-for-utf-8\u2466"},{"id":"ref-for-utf-8\u2467"},{"id":"ref-for-utf-8\u2468"},{"id":"ref-for-utf-8\u2460\u24ea"}],"title":"6. Hooks for standards"},{"refs":[{"id":"ref-for-utf-8\u2460\u2460"},{"id":"ref-for-utf-8\u2460\u2461"}],"title":"6.1. Legacy hooks for standards"},{"refs":[{"id":"ref-for-utf-8\u2460\u2462"},{"id":"ref-for-utf-8\u2460\u2463"}],"title":"7. API"},{"refs":[{"id":"ref-for-utf-8\u2460\u2464"}],"title":"7.1. Interface mixin TextDecoderCommon"},{"refs":[{"id":"ref-for-utf-8\u2460\u2465"},{"id":"ref-for-utf-8\u2460\u2466"}],"title":"7.4. Interface TextEncoder"},{"refs":[{"id":"ref-for-utf-8\u2460\u2467"},{"id":"ref-for-utf-8\u2460\u2468"},{"id":"ref-for-utf-8\u2461\u24ea"},{"id":"ref-for-utf-8\u2461\u2460"}],"title":"7.6. Interface TextEncoderStream"},{"refs":[{"id":"ref-for-utf-8"}],"title":"8.1. UTF-8"},{"refs":[{"id":"ref-for-utf-8\u2461\u2461"},{"id":"ref-for-utf-8\u2461\u2462"}],"title":"8.1.1. UTF-8 decoder"},{"refs":[{"id":"ref-for-utf-8\u2461\u2463"}],"title":"8.1.2. UTF-8 encoder"}],"url":"#utf-8"}, "utf-8-bytes-needed": {"dfnID":"utf-8-bytes-needed","dfnText":"UTF-8 bytes needed","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-8-bytes-needed"},{"id":"ref-for-utf-8-bytes-needed\u2460"},{"id":"ref-for-utf-8-bytes-needed\u2461"},{"id":"ref-for-utf-8-bytes-needed\u2462"},{"id":"ref-for-utf-8-bytes-needed\u2463"},{"id":"ref-for-utf-8-bytes-needed\u2464"},{"id":"ref-for-utf-8-bytes-needed\u2465"},{"id":"ref-for-utf-8-bytes-needed\u2466"},{"id":"ref-for-utf-8-bytes-needed\u2467"}],"title":"8.1.1. UTF-8 decoder"}],"url":"#utf-8-bytes-needed"}, "utf-8-bytes-seen": {"dfnID":"utf-8-bytes-seen","dfnText":"UTF-8 bytes seen","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-8-bytes-seen"},{"id":"ref-for-utf-8-bytes-seen\u2460"},{"id":"ref-for-utf-8-bytes-seen\u2461"},{"id":"ref-for-utf-8-bytes-seen\u2462"}],"title":"8.1.1. UTF-8 decoder"}],"url":"#utf-8-bytes-seen"}, "utf-8-code-point": {"dfnID":"utf-8-code-point","dfnText":"UTF-8 code point","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-8-code-point"},{"id":"ref-for-utf-8-code-point\u2460"},{"id":"ref-for-utf-8-code-point\u2461"},{"id":"ref-for-utf-8-code-point\u2462"},{"id":"ref-for-utf-8-code-point\u2463"},{"id":"ref-for-utf-8-code-point\u2464"},{"id":"ref-for-utf-8-code-point\u2465"},{"id":"ref-for-utf-8-code-point\u2466"},{"id":"ref-for-utf-8-code-point\u2467"}],"title":"8.1.1. UTF-8 decoder"}],"url":"#utf-8-code-point"}, "utf-8-decode": {"dfnID":"utf-8-decode","dfnText":"UTF-8 decode","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-8-decode"}],"title":"4. Encodings"},{"refs":[{"id":"ref-for-utf-8-decode\u2460"},{"id":"ref-for-utf-8-decode\u2461"}],"title":"6. Hooks for standards"},{"refs":[{"id":"ref-for-utf-8-decode\u2462"}],"title":"8.1.1. UTF-8 decoder"}],"url":"#utf-8-decode"}, "utf-8-decode-without-bom": {"dfnID":"utf-8-decode-without-bom","dfnText":"UTF-8 decode without BOM","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-8-decode-without-bom"},{"id":"ref-for-utf-8-decode-without-bom\u2460"}],"title":"6. Hooks for standards"}],"url":"#utf-8-decode-without-bom"}, "utf-8-decode-without-bom-or-fail": {"dfnID":"utf-8-decode-without-bom-or-fail","dfnText":"UTF-8 decode without BOM or fail","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-8-decode-without-bom-or-fail"},{"id":"ref-for-utf-8-decode-without-bom-or-fail\u2460"},{"id":"ref-for-utf-8-decode-without-bom-or-fail\u2461"}],"title":"6. Hooks for standards"}],"url":"#utf-8-decode-without-bom-or-fail"}, "utf-8-decoder": {"dfnID":"utf-8-decoder","dfnText":"8.1.1. UTF-8 decoder","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-8-decoder"},{"id":"ref-for-utf-8-decoder"},{"id":"ref-for-utf-8-decoder\u2460"}],"title":"8.1.1. UTF-8 decoder"}],"url":"#utf-8-decoder"}, "utf-8-encode": {"dfnID":"utf-8-encode","dfnText":"UTF-8 encode","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-8-encode"},{"id":"ref-for-utf-8-encode\u2460"},{"id":"ref-for-utf-8-encode\u2461"}],"title":"6. Hooks for standards"},{"refs":[{"id":"ref-for-utf-8-encode\u2462"}],"title":"6.1. Legacy hooks for standards"}],"url":"#utf-8-encode"}, "utf-8-encoder": {"dfnID":"utf-8-encoder","dfnText":"8.1.2. UTF-8 encoder","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-8-encoder"},{"id":"ref-for-utf-8-encoder\u2460"},{"id":"ref-for-utf-8-encoder\u2461"},{"id":"ref-for-utf-8-encoder\u2462"},{"id":"ref-for-utf-8-encoder\u2463"}],"title":"7.4. Interface TextEncoder"},{"refs":[{"id":"ref-for-utf-8-encoder\u2464"}],"title":"7.6. Interface TextEncoderStream"},{"refs":[{"id":"ref-for-utf-8-encoder"}],"title":"8.1.2. UTF-8 encoder"}],"url":"#utf-8-encoder"}, "utf-8-lower-boundary": {"dfnID":"utf-8-lower-boundary","dfnText":"UTF-8 lower boundary","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-8-lower-boundary"},{"id":"ref-for-utf-8-lower-boundary\u2460"},{"id":"ref-for-utf-8-lower-boundary\u2461"},{"id":"ref-for-utf-8-lower-boundary\u2462"},{"id":"ref-for-utf-8-lower-boundary\u2463"}],"title":"8.1.1. UTF-8 decoder"}],"url":"#utf-8-lower-boundary"}, "utf-8-upper-boundary": {"dfnID":"utf-8-upper-boundary","dfnText":"UTF-8 upper boundary","external":false,"refSections":[{"refs":[{"id":"ref-for-utf-8-upper-boundary"},{"id":"ref-for-utf-8-upper-boundary\u2460"},{"id":"ref-for-utf-8-upper-boundary\u2461"},{"id":"ref-for-utf-8-upper-boundary\u2462"},{"id":"ref-for-utf-8-upper-boundary\u2463"}],"title":"8.1.1. UTF-8 decoder"}],"url":"#utf-8-upper-boundary"}, "windows-1250": {"dfnID":"windows-1250","dfnText":"windows-1250","external":false,"refSections":[{"refs":[{"id":"ref-for-windows-1250"}],"title":"4.2. Names and labels"}],"url":"#windows-1250"}, "windows-1251": {"dfnID":"windows-1251","dfnText":"windows-1251","external":false,"refSections":[{"refs":[{"id":"ref-for-windows-1251"}],"title":"4.2. Names and labels"}],"url":"#windows-1251"}, "windows-1252": {"dfnID":"windows-1252","dfnText":"windows-1252","external":false,"refSections":[{"refs":[{"id":"ref-for-windows-1252"}],"title":"2. Security background"},{"refs":[{"id":"ref-for-windows-1252\u2460"}],"title":"4.2. Names and labels"}],"url":"#windows-1252"}, "windows-1253": {"dfnID":"windows-1253","dfnText":"windows-1253","external":false,"refSections":[{"refs":[{"id":"ref-for-windows-1253"}],"title":"4.2. Names and labels"}],"url":"#windows-1253"}, "windows-1254": {"dfnID":"windows-1254","dfnText":"windows-1254","external":false,"refSections":[{"refs":[{"id":"ref-for-windows-1254"}],"title":"4.2. Names and labels"}],"url":"#windows-1254"}, "windows-1255": {"dfnID":"windows-1255","dfnText":"windows-1255","external":false,"refSections":[{"refs":[{"id":"ref-for-windows-1255"}],"title":"4.2. Names and labels"}],"url":"#windows-1255"}, "windows-1256": {"dfnID":"windows-1256","dfnText":"windows-1256","external":false,"refSections":[{"refs":[{"id":"ref-for-windows-1256"}],"title":"4.2. Names and labels"}],"url":"#windows-1256"}, "windows-1257": {"dfnID":"windows-1257","dfnText":"windows-1257","external":false,"refSections":[{"refs":[{"id":"ref-for-windows-1257"}],"title":"4.2. Names and labels"}],"url":"#windows-1257"}, "windows-1258": {"dfnID":"windows-1258","dfnText":"windows-1258","external":false,"refSections":[{"refs":[{"id":"ref-for-windows-1258"}],"title":"4.2. Names and labels"}],"url":"#windows-1258"}, "windows-874": {"dfnID":"windows-874","dfnText":"windows-874","external":false,"refSections":[{"refs":[{"id":"ref-for-windows-874"}],"title":"4.2. Names and labels"}],"url":"#windows-874"}, "x-mac-cyrillic": {"dfnID":"x-mac-cyrillic","dfnText":"x-mac-cyrillic","external":false,"refSections":[{"refs":[{"id":"ref-for-x-mac-cyrillic"},{"id":"ref-for-x-mac-cyrillic\u2460"}],"title":"4.2. Names and labels"}],"url":"#x-mac-cyrillic"}, "x-user-defined": {"dfnID":"x-user-defined","dfnText":"14.5. x-user-defined","external":false,"refSections":[{"refs":[{"id":"ref-for-x-user-defined"}],"title":"4.2. Names and labels"},{"refs":[{"id":"ref-for-x-user-defined"}],"title":"14.5. x-user-defined"},{"refs":[{"id":"ref-for-x-user-defined\u2460"}],"title":"14.5.1. x-user-defined decoder"},{"refs":[{"id":"ref-for-x-user-defined\u2461"}],"title":"14.5.2. x-user-defined encoder"}],"url":"#x-user-defined"}, "x-user-defined-decoder": {"dfnID":"x-user-defined-decoder","dfnText":"14.5.1. x-user-defined decoder","external":false,"refSections":[{"refs":[{"id":"ref-for-x-user-defined-decoder"}],"title":"14.5.1. x-user-defined decoder"}],"url":"#x-user-defined-decoder"}, "x-user-defined-encoder": {"dfnID":"x-user-defined-encoder","dfnText":"14.5.2. x-user-defined encoder","external":false,"refSections":[{"refs":[{"id":"ref-for-x-user-defined-encoder"}],"title":"14.5.2. x-user-defined encoder"}],"url":"#x-user-defined-encoder"}, }; document.addEventListener("DOMContentLoaded", ()=>{ genAllDfnPanels(); document.body.addEventListener("click", (e) => { // If not handled already, just hide all dfn panels. hideAllDfnPanels(); }); }); window.addEventListener("resize", () => { // Pin any visible dfn panel queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(el=>positionDfnPanel(el)); }); function genAllDfnPanels() { for(const panelData of Object.values(dfnPanelData)) { const dfnID = panelData.dfnID; const dfn = document.getElementById(dfnID); if(!dfn) { console.log(`Can't find dfn#${dfnID}.`, panelData); continue; } dfn.panelData = panelData; insertDfnPopupAction(dfn); } } function genDfnPanel(dfn, { dfnID, url, dfnText, refSections, external }) { const dfnPanel = mk.aside({ class: "dfn-panel on", id: `infopanel-for-${dfnID}`, "data-for": dfnID, "aria-labelled-by":`infopaneltitle-for-${dfnID}`, }, mk.span({id:`infopaneltitle-for-${dfnID}`, style:"display:none"}, `Info about the '${dfnText}' ${external?"external":""} reference.`), mk.a({href:url, class:"dfn-link"}, url), refSections.length == 0 ? [] : mk.b({}, "Referenced in:"), mk.ul({}, ...refSections.map(section=> mk.li({}, ...section.refs.map((ref, refI)=> [ mk.a({ href: `#${ref.id}` }, (refI == 0) ? section.title : `(${refI + 1})` ), " ", ] ), ), ), ), genLinkingSyntaxes(dfn), ); dfnPanel.addEventListener('click', (event) => { if (event.target.nodeName == 'A') { scrollToTargetAndHighlight(event); pinDfnPanel(dfnPanel); } event.stopPropagation(); refocusOnTarget(event); }); dfnPanel.addEventListener('keydown', (event) => { if(event.keyCode == 27) { // Escape key hideDfnPanel({dfnPanel}); event.stopPropagation(); event.preventDefault(); } }); dfnPanel.dfn = dfn; dfn.dfnPanel = dfnPanel; return dfnPanel; } function hideAllDfnPanels() { // Delete the currently-active dfn panel. queryAll(".dfn-panel").forEach(dfnPanel=>hideDfnPanel({dfnPanel})); } function showDfnPanel(dfn) { hideAllDfnPanels(); // Only display one at a time. dfn.setAttribute("aria-expanded", "true"); const dfnPanel = genDfnPanel(dfn, dfn.panelData); // Give the dfn a unique tabindex, and then // give all the tabbable panel bits successive indexes. let tabIndex = 100; dfn.tabIndex = tabIndex++; const tabbable = dfnPanel.querySelectorAll(":is(a, button)"); for (const el of tabbable) { el.tabIndex = tabIndex++; } append(document.body, dfnPanel); positionDfnPanel(dfnPanel); } function positionDfnPanel(dfnPanel) { const dfn = dfnPanel.dfn; const dfnPos = getBounds(dfn); dfnPanel.style.top = dfnPos.bottom + "px"; dfnPanel.style.left = dfnPos.left + "px"; const panelPos = dfnPanel.getBoundingClientRect(); const panelMargin = 8; const maxRight = document.body.parentNode.clientWidth - panelMargin; if (panelPos.right > maxRight) { const overflowAmount = panelPos.right - maxRight; const newLeft = Math.max(panelMargin, dfnPos.left - overflowAmount); dfnPanel.style.left = newLeft + "px"; } } function pinDfnPanel(dfnPanel) { // Switch it to "activated" state, which pins it. dfnPanel.classList.add("activated"); dfnPanel.style.position = "fixed"; dfnPanel.style.left = null; dfnPanel.style.top = null; } function hideDfnPanel({dfn, dfnPanel}) { if(!dfnPanel) dfnPanel = dfn.dfnPanel; if(!dfn) dfn = dfnPanel.dfn; dfn.dfnPanel = undefined; dfnPanel.dfn = undefined; dfn.setAttribute("aria-expanded", "false"); dfn.tabIndex = undefined; dfnPanel.remove() } function toggleDfnPanel(dfn) { if(dfn.dfnPanel) { hideDfnPanel(dfn); } else { showDfnPanel(dfn); } } function insertDfnPopupAction(dfn) { dfn.setAttribute('role', 'button'); dfn.setAttribute('aria-expanded', 'false') dfn.tabIndex = 0; dfn.classList.add('has-dfn-panel'); dfn.addEventListener('click', (event) => { toggleDfnPanel(dfn); event.stopPropagation(); }); dfn.addEventListener('keypress', (event) => { const kc = event.keyCode; // 32->Space, 13->Enter if(kc == 32 || kc == 13) { toggleDfnPanel(dfn); event.stopPropagation(); event.preventDefault(); } }); } function refocusOnTarget(event) { const target = event.target; setTimeout(() => { // Refocus on the event.target element. // This is needed after browser scrolls to the destination. target.focus(); }); } // TODO: shared util // Returns the root-level absolute position {left and top} of element. function getBounds(el, relativeTo=document.body) { const relativeRect = relativeTo.getBoundingClientRect(); const elRect = el.getBoundingClientRect(); const top = elRect.top - relativeRect.top; const left = elRect.left - relativeRect.left; return { top, left, bottom: top + elRect.height, right: left + elRect.width, } } function scrollToTargetAndHighlight(event) { let hash = event.target.hash; if (hash) { hash = decodeURIComponent(hash.substring(1)); const dest = document.getElementById(hash); if (dest) { dest.classList.add('highlighted'); setTimeout(() => dest.classList.remove('highlighted'), 1000); } } } // Functions, divided by link type, that wrap an autolink's // contents with the appropriate outer syntax. // Alternately, a string naming another type they format // the same as. function needsFor(type) { switch(type) { case "descriptor": case "value": case "element-attr": case "attr-value": case "element-state": case "method": case "constructor": case "argument": case "attribute": case "const": case "dict-member": case "event": case "enum-value": case "stringifier": case "serializer": case "iterator": case "maplike": case "setlike": case "state": case "mode": case "context": case "facet": return true; default: return false; } } function refusesFor(type) { switch(type) { case "property": case "element": case "interface": case "namespace": case "callback": case "dictionary": case "enum": case "exception": case "typedef": case "http-header": case "permission": return true; default: return false; } } function linkFormatterFromType(type) { switch(type) { case 'scheme': case 'permission': case 'dfn': return (text) => `[=${text}=]`; case 'abstract-op': return (text) => `[\$${text}\$]`; case 'function': case 'at-rule': case 'selector': case 'value': return (text) => `''${text}''`; case 'http-header': return (text) => `[:${text}:]`; case 'interface': case 'constructor': case 'method': case 'argument': case 'attribute': case 'callback': case 'dictionary': case 'dict-member': case 'enum': case 'enum-value': case 'exception': case 'const': case 'typedef': case 'stringifier': case 'serializer': case 'iterator': case 'maplike': case 'setlike': case 'extended-attribute': case 'event': case 'idl': return (text) => `{{${text}}}`; case 'element-state': case 'element-attr': case 'attr-value': case 'element': return (element) => `<{${element}}>`; case 'grammar': return (text) => `${text} (within a <pre class=prod>)`; case 'type': return (text)=> `<<${text}>>`; case 'descriptor': case 'property': return (text) => `'${text}'`; default: return; }; }; function genLinkingSyntaxes(dfn) { if(dfn.tagName != "DFN") return; const type = dfn.getAttribute('data-dfn-type'); if(!type) { console.log(`<dfn> doesn't have a data-dfn-type:`, dfn); return []; } // Return a function that wraps link text based on the type const linkFormatter = linkFormatterFromType(type); if(!linkFormatter) { console.log(`<dfn> has an unknown data-dfn-type:`, dfn); return []; } let ltAlts; if(dfn.hasAttribute('data-lt')) { ltAlts = dfn.getAttribute('data-lt') .split("|") .map(x=>x.trim()); } else { ltAlts = [dfn.textContent.trim()]; } if(type == "type") { // lt of "<foo>", but "foo" is the interior; // <<foo/bar>> is how you write it with a for, // not <foo/<bar>> or whatever. for(var i = 0; i < ltAlts.length; i++) { const lt = ltAlts[i]; const match = /<(.*)>/.exec(lt); if(match) { ltAlts[i] = match[1]; } } } let forAlts; if(dfn.hasAttribute('data-dfn-for')) { forAlts = dfn.getAttribute('data-dfn-for') .split(",") .map(x=>x.trim()); } else { forAlts = ['']; } let linkingSyntaxes = []; if(!needsFor(type)) { for(const lt of ltAlts) { linkingSyntaxes.push(linkFormatter(lt)); } } if(!refusesFor(type)) { for(const f of forAlts) { linkingSyntaxes.push(linkFormatter(`${f}/${ltAlts[0]}`)) } } return [ mk.b({}, 'Possible linking syntaxes:'), mk.ul({}, ...linkingSyntaxes.map(link => { const copyLink = async () => await navigator.clipboard.writeText(link); return mk.li({}, mk.div({ class: 'link-item' }, mk.button({ class: 'copy-icon', title: 'Copy', type: 'button', _onclick: copyLink, tabindex: 0, }, mk.span({ class: 'icon' }) ), mk.span({}, link) ) ); }) ) ]; } } </script> <script>/* Boilerplate: script-position-annos */ "use strict"; { function repositionAnnoPanels(){ const panels = [...document.querySelectorAll("[data-anno-for]")]; hydratePanels(panels); let vSoFar = 0; for(const panel of panels.sort(cmpTops)) { if(panel.top < vSoFar) { panel.top = vSoFar; panel.style.top = vSoFar + "px"; } vSoFar = panel.top + panel.height + 15; } } function hydratePanels(panels) { const main = document.querySelector("main"); let mainRect; if(main) mainRect = main.getBoundingClientRect(); // First display them all, if they're not already visible. for(const panel of panels) { panel.classList.remove("unpositioned"); } // Measure them all for(const panel of panels) { const dfn = document.getElementById(panel.getAttribute("data-anno-for")); if(!dfn) { console.log("Can't find the annotation panel target:", panel); continue; } panel.dfn = dfn; panel.top = window.scrollY + dfn.getBoundingClientRect().top; let panelRect = panel.getBoundingClientRect(); panel.height = panelRect.height; if(main) { panel.overlappingMain = panelRect.left < mainRect.right; } else { panel.overlappingMain = false; } } // And finally position them for(const panel of panels) { const dfn = panel.dfn; if(!dfn) continue; panel.style.top = panel.top + "px"; panel.classList.toggle("overlapping-main", panel.overlappingMain); } } function cmpTops(a,b) { return a.top - b.top; } window.addEventListener("load", repositionAnnoPanels); window.addEventListener("resize", repositionAnnoPanels); } </script> <script>/* Boilerplate: script-ref-hints */ "use strict"; { let refsData = { "#big5": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"big5","type":"dfn","url":"#big5"}, "#big5-lead": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"big5 lead","type":"dfn","url":"#big5-lead"}, "#bom-sniff": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"bom sniff","type":"dfn","url":"#bom-sniff"}, "#concept-encoding-get": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"get an encoding","type":"dfn","url":"#concept-encoding-get"}, "#concept-encoding-process": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"processing an item","type":"dfn","url":"#concept-encoding-process"}, "#concept-encoding-run": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"process a queue","type":"dfn","url":"#concept-encoding-run"}, "#concept-stream": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"i/o queue","type":"dfn","url":"#concept-stream"}, "#concept-stream-prepend": {"export":true,"for_":["I/O queue"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"restore","type":"dfn","url":"#concept-stream-prepend"}, "#concept-stream-push": {"export":true,"for_":["I/O queue"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"push","type":"dfn","url":"#concept-stream-push"}, "#concept-stream-read": {"export":true,"for_":["I/O queue"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"read","type":"dfn","url":"#concept-stream-read"}, "#concept-td-serialize": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"serialize i/o queue","type":"dfn","url":"#concept-td-serialize"}, "#continue": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"continue","type":"dfn","url":"#continue"}, "#convert-code-unit-to-scalar-value": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"convert code unit to scalar value","type":"dfn","url":"#convert-code-unit-to-scalar-value"}, "#decode": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"decode","type":"dfn","url":"#decode"}, "#decode-and-enqueue-a-chunk": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"decode and enqueue a chunk","type":"dfn","url":"#decode-and-enqueue-a-chunk"}, "#decoder": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"decoder","type":"dfn","url":"#decoder"}, "#dictdef-textencoderencodeintoresult": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"TextEncoderEncodeIntoResult","type":"dictionary","url":"#dictdef-textencoderencodeintoresult"}, "#dom-textdecodeoptions-stream": {"export":true,"for_":["TextDecodeOptions"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"stream","type":"dict-member","url":"#dom-textdecodeoptions-stream"}, "#dom-textdecoder": {"export":true,"for_":["TextDecoder"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"TextDecoder(label, options)","type":"constructor","url":"#dom-textdecoder"}, "#dom-textdecoder-decode": {"export":true,"for_":["TextDecoder"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"decode(input, options)","type":"method","url":"#dom-textdecoder-decode"}, "#dom-textdecoder-encoding": {"export":true,"for_":["TextDecoderCommon"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"encoding","type":"attribute","url":"#dom-textdecoder-encoding"}, "#dom-textdecoder-fatal": {"export":true,"for_":["TextDecoderCommon"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"fatal","type":"attribute","url":"#dom-textdecoder-fatal"}, "#dom-textdecoder-ignorebom": {"export":true,"for_":["TextDecoderCommon"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"ignoreBOM","type":"attribute","url":"#dom-textdecoder-ignorebom"}, "#dom-textdecoderoptions-fatal": {"export":true,"for_":["TextDecoderOptions"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"fatal","type":"dict-member","url":"#dom-textdecoderoptions-fatal"}, "#dom-textdecoderoptions-ignorebom": {"export":true,"for_":["TextDecoderOptions"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"ignoreBOM","type":"dict-member","url":"#dom-textdecoderoptions-ignorebom"}, "#dom-textdecoderstream": {"export":true,"for_":["TextDecoderStream"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"TextDecoderStream(label, options)","type":"constructor","url":"#dom-textdecoderstream"}, "#dom-textencoder": {"export":true,"for_":["TextEncoder"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"TextEncoder()","type":"constructor","url":"#dom-textencoder"}, "#dom-textencoder-encode": {"export":true,"for_":["TextEncoder"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"encode(input)","type":"method","url":"#dom-textencoder-encode"}, "#dom-textencoder-encodeinto": {"export":true,"for_":["TextEncoder"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"encodeInto(source, destination)","type":"method","url":"#dom-textencoder-encodeinto"}, "#dom-textencoder-encoding": {"export":true,"for_":["TextEncoderCommon"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"encoding","type":"attribute","url":"#dom-textencoder-encoding"}, "#dom-textencoderencodeintoresult-read": {"export":true,"for_":["TextEncoderEncodeIntoResult"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"read","type":"dict-member","url":"#dom-textencoderencodeintoresult-read"}, "#dom-textencoderencodeintoresult-written": {"export":true,"for_":["TextEncoderEncodeIntoResult"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"written","type":"dict-member","url":"#dom-textencoderencodeintoresult-written"}, "#dom-textencoderstream": {"export":true,"for_":["TextEncoderStream"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"TextEncoderStream()","type":"constructor","url":"#dom-textencoderstream"}, "#encode": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"encode","type":"dfn","url":"#encode"}, "#encode-and-enqueue-a-chunk": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"encode and enqueue a chunk","type":"dfn","url":"#encode-and-enqueue-a-chunk"}, "#encode-and-flush": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"encode and flush","type":"dfn","url":"#encode-and-flush"}, "#encode-or-fail": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"encode or fail","type":"dfn","url":"#encode-or-fail"}, "#encoder": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"encoder","type":"dfn","url":"#encoder"}, "#encoding": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"encoding","type":"dfn","url":"#encoding"}, "#end-of-stream": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"end-of-queue","type":"dfn","url":"#end-of-stream"}, "#error": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"error","type":"dfn","url":"#error"}, "#error-mode": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"error mode","type":"dfn","url":"#error-mode"}, "#euc-jp": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"euc-jp","type":"dfn","url":"#euc-jp"}, "#euc-jp-decoder": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"euc-jp decoder","type":"dfn","url":"#euc-jp-decoder"}, "#euc-jp-jis0212-flag": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"euc-jp jis0212","type":"dfn","url":"#euc-jp-jis0212-flag"}, "#euc-jp-lead": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"euc-jp lead","type":"dfn","url":"#euc-jp-lead"}, "#euc-kr": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"euc-kr","type":"dfn","url":"#euc-kr"}, "#euc-kr-lead": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"euc-kr lead","type":"dfn","url":"#euc-kr-lead"}, "#finished": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"finished","type":"dfn","url":"#finished"}, "#flush-and-enqueue": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"flush and enqueue","type":"dfn","url":"#flush-and-enqueue"}, "#from-i-o-queue-convert": {"export":true,"for_":["from I/O queue"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"convert","type":"dfn","url":"#from-i-o-queue-convert"}, "#gb18030": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"gb18030","type":"dfn","url":"#gb18030"}, "#gb18030-decoder": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"gb18030 decoder","type":"dfn","url":"#gb18030-decoder"}, "#gb18030-encoder": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"gb18030 encoder","type":"dfn","url":"#gb18030-encoder"}, "#gb18030-first": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"gb18030 first","type":"dfn","url":"#gb18030-first"}, "#gb18030-second": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"gb18030 second","type":"dfn","url":"#gb18030-second"}, "#gb18030-third": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"gb18030 third","type":"dfn","url":"#gb18030-third"}, "#gbk": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"gbk","type":"dfn","url":"#gbk"}, "#gbk-flag": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"is gbk","type":"dfn","url":"#gbk-flag"}, "#get-an-encoder": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"get an encoder","type":"dfn","url":"#get-an-encoder"}, "#get-an-output-encoding": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"get an output encoding","type":"dfn","url":"#get-an-output-encoding"}, "#handler": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"handler","type":"dfn","url":"#handler"}, "#i-o-queue-peek": {"export":true,"for_":["I/O queue"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"peek","type":"dfn","url":"#i-o-queue-peek"}, "#ibm866": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"ibm866","type":"dfn","url":"#ibm866"}, "#index": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"index","type":"dfn","url":"#index"}, "#index-big5": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"index big5","type":"dfn","url":"#index-big5"}, "#index-big5-pointer": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"index big5 pointer","type":"dfn","url":"#index-big5-pointer"}, "#index-code-point": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"index code point","type":"dfn","url":"#index-code-point"}, "#index-euc-kr": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"index euc-kr","type":"dfn","url":"#index-euc-kr"}, "#index-gb18030": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"index gb18030","type":"dfn","url":"#index-gb18030"}, "#index-gb18030-ranges": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"index gb18030 ranges","type":"dfn","url":"#index-gb18030-ranges"}, "#index-gb18030-ranges-code-point": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"index gb18030 ranges code point","type":"dfn","url":"#index-gb18030-ranges-code-point"}, "#index-gb18030-ranges-pointer": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"index gb18030 ranges pointer","type":"dfn","url":"#index-gb18030-ranges-pointer"}, "#index-iso-2022-jp-katakana": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"index iso-2022-jp katakana","type":"dfn","url":"#index-iso-2022-jp-katakana"}, "#index-jis0208": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"index jis0208","type":"dfn","url":"#index-jis0208"}, "#index-jis0212": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"index jis0212","type":"dfn","url":"#index-jis0212"}, "#index-pointer": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"index pointer","type":"dfn","url":"#index-pointer"}, "#index-shift_jis-pointer": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"index shift_jis pointer","type":"dfn","url":"#index-shift_jis-pointer"}, "#index-single-byte": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"index single-byte","type":"dfn","url":"#index-single-byte"}, "#iso-2022-jp": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-2022-jp","type":"dfn","url":"#iso-2022-jp"}, "#iso-2022-jp-decoder-ascii": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-2022-jp decoder ascii","type":"dfn","url":"#iso-2022-jp-decoder-ascii"}, "#iso-2022-jp-decoder-escape": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-2022-jp decoder escape","type":"dfn","url":"#iso-2022-jp-decoder-escape"}, "#iso-2022-jp-decoder-escape-start": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-2022-jp decoder escape start","type":"dfn","url":"#iso-2022-jp-decoder-escape-start"}, "#iso-2022-jp-decoder-katakana": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-2022-jp decoder katakana","type":"dfn","url":"#iso-2022-jp-decoder-katakana"}, "#iso-2022-jp-decoder-lead-byte": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-2022-jp decoder lead byte","type":"dfn","url":"#iso-2022-jp-decoder-lead-byte"}, "#iso-2022-jp-decoder-output-state": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-2022-jp decoder output state","type":"dfn","url":"#iso-2022-jp-decoder-output-state"}, "#iso-2022-jp-decoder-roman": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-2022-jp decoder roman","type":"dfn","url":"#iso-2022-jp-decoder-roman"}, "#iso-2022-jp-decoder-state": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-2022-jp decoder state","type":"dfn","url":"#iso-2022-jp-decoder-state"}, "#iso-2022-jp-decoder-trail-byte": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-2022-jp decoder trail byte","type":"dfn","url":"#iso-2022-jp-decoder-trail-byte"}, "#iso-2022-jp-encoder": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-2022-jp encoder","type":"dfn","url":"#iso-2022-jp-encoder"}, "#iso-2022-jp-encoder-ascii": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-2022-jp encoder ascii","type":"dfn","url":"#iso-2022-jp-encoder-ascii"}, "#iso-2022-jp-encoder-jis0208": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-2022-jp encoder jis0208","type":"dfn","url":"#iso-2022-jp-encoder-jis0208"}, "#iso-2022-jp-encoder-roman": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-2022-jp encoder roman","type":"dfn","url":"#iso-2022-jp-encoder-roman"}, "#iso-2022-jp-encoder-state": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-2022-jp encoder state","type":"dfn","url":"#iso-2022-jp-encoder-state"}, "#iso-2022-jp-lead": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-2022-jp lead","type":"dfn","url":"#iso-2022-jp-lead"}, "#iso-2022-jp-output-flag": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-2022-jp output","type":"dfn","url":"#iso-2022-jp-output-flag"}, "#iso-8859-10": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-8859-10","type":"dfn","url":"#iso-8859-10"}, "#iso-8859-13": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-8859-13","type":"dfn","url":"#iso-8859-13"}, "#iso-8859-14": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-8859-14","type":"dfn","url":"#iso-8859-14"}, "#iso-8859-15": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-8859-15","type":"dfn","url":"#iso-8859-15"}, "#iso-8859-16": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-8859-16","type":"dfn","url":"#iso-8859-16"}, "#iso-8859-2": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-8859-2","type":"dfn","url":"#iso-8859-2"}, "#iso-8859-3": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-8859-3","type":"dfn","url":"#iso-8859-3"}, "#iso-8859-4": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-8859-4","type":"dfn","url":"#iso-8859-4"}, "#iso-8859-5": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-8859-5","type":"dfn","url":"#iso-8859-5"}, "#iso-8859-6": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-8859-6","type":"dfn","url":"#iso-8859-6"}, "#iso-8859-7": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-8859-7","type":"dfn","url":"#iso-8859-7"}, "#iso-8859-8": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-8859-8","type":"dfn","url":"#iso-8859-8"}, "#iso-8859-8-i": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"iso-8859-8-i","type":"dfn","url":"#iso-8859-8-i"}, "#koi8-r": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"koi8-r","type":"dfn","url":"#koi8-r"}, "#koi8-u": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"koi8-u","type":"dfn","url":"#koi8-u"}, "#label": {"export":true,"for_":["encoding"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"label","type":"dfn","url":"#label"}, "#macintosh": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"macintosh","type":"dfn","url":"#macintosh"}, "#name": {"export":true,"for_":["encoding"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"name","type":"dfn","url":"#name"}, "#replacement": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"replacement","type":"dfn","url":"#replacement"}, "#replacement-error-returned-flag": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"replacement error returned","type":"dfn","url":"#replacement-error-returned-flag"}, "#scalar-value-from-surrogates": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"scalar value from surrogates","type":"dfn","url":"#scalar-value-from-surrogates"}, "#shared-utf-16-decoder": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"shared utf-16 decoder","type":"dfn","url":"#shared-utf-16-decoder"}, "#shift_jis": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"shift_jis","type":"dfn","url":"#shift_jis"}, "#shift_jis-lead": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"shift_jis lead","type":"dfn","url":"#shift_jis-lead"}, "#single-byte-decoder": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"single-byte decoder","type":"dfn","url":"#single-byte-decoder"}, "#single-byte-encoder": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"single-byte encoder","type":"dfn","url":"#single-byte-encoder"}, "#single-byte-encoding": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"single-byte encoding","type":"dfn","url":"#single-byte-encoding"}, "#textdecodeoptions": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"TextDecodeOptions","type":"dictionary","url":"#textdecodeoptions"}, "#textdecoder": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"TextDecoder","type":"interface","url":"#textdecoder"}, "#textdecoder-bom-seen-flag": {"export":true,"for_":["TextDecoderCommon"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"bom seen","type":"dfn","url":"#textdecoder-bom-seen-flag"}, "#textdecoder-do-not-flush-flag": {"export":true,"for_":["TextDecoder"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"do not flush","type":"dfn","url":"#textdecoder-do-not-flush-flag"}, "#textdecoder-encoding": {"export":true,"for_":["TextDecoderCommon"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"encoding","type":"dfn","url":"#textdecoder-encoding"}, "#textdecoder-error-mode": {"export":true,"for_":["TextDecoderCommon"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"error mode","type":"dfn","url":"#textdecoder-error-mode"}, "#textdecoder-ignore-bom-flag": {"export":true,"for_":["TextDecoderCommon"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"ignore bom","type":"dfn","url":"#textdecoder-ignore-bom-flag"}, "#textdecodercommon": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"TextDecoderCommon","type":"interface","url":"#textdecodercommon"}, "#textdecodercommon-decoder": {"export":true,"for_":["TextDecoderCommon"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"decoder","type":"dfn","url":"#textdecodercommon-decoder"}, "#textdecodercommon-i-o-queue": {"export":true,"for_":["TextDecoderCommon"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"i/o queue","type":"dfn","url":"#textdecodercommon-i-o-queue"}, "#textdecoderoptions": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"TextDecoderOptions","type":"dictionary","url":"#textdecoderoptions"}, "#textdecoderstream": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"TextDecoderStream","type":"interface","url":"#textdecoderstream"}, "#textencoder": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"TextEncoder","type":"interface","url":"#textencoder"}, "#textencodercommon": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"TextEncoderCommon","type":"interface","url":"#textencodercommon"}, "#textencoderstream": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"TextEncoderStream","type":"interface","url":"#textencoderstream"}, "#textencoderstream-encoder": {"export":true,"for_":["TextEncoderStream"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"encoder","type":"dfn","url":"#textencoderstream-encoder"}, "#textencoderstream-pending-high-surrogate": {"export":true,"for_":["TextEncoderStream"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"leading surrogate","type":"dfn","url":"#textencoderstream-pending-high-surrogate"}, "#to-i-o-queue-convert": {"export":true,"for_":["to I/O queue"],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"convert","type":"dfn","url":"#to-i-o-queue-convert"}, "#utf-16-lead-byte": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"utf-16 lead byte","type":"dfn","url":"#utf-16-lead-byte"}, "#utf-16-lead-surrogate": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"utf-16 leading surrogate","type":"dfn","url":"#utf-16-lead-surrogate"}, "#utf-16be": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"utf-16be","type":"dfn","url":"#utf-16be"}, "#utf-16be-decoder-flag": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"is utf-16be decoder","type":"dfn","url":"#utf-16be-decoder-flag"}, "#utf-16be-le": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"utf-16be/le","type":"dfn","url":"#utf-16be-le"}, "#utf-16le": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"utf-16le","type":"dfn","url":"#utf-16le"}, "#utf-8": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"utf-8","type":"dfn","url":"#utf-8"}, "#utf-8-bytes-needed": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"utf-8 bytes needed","type":"dfn","url":"#utf-8-bytes-needed"}, "#utf-8-bytes-seen": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"utf-8 bytes seen","type":"dfn","url":"#utf-8-bytes-seen"}, "#utf-8-code-point": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"utf-8 code point","type":"dfn","url":"#utf-8-code-point"}, "#utf-8-decode": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"utf-8 decode","type":"dfn","url":"#utf-8-decode"}, "#utf-8-decode-without-bom": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"utf-8 decode without bom","type":"dfn","url":"#utf-8-decode-without-bom"}, "#utf-8-decode-without-bom-or-fail": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"utf-8 decode without bom or fail","type":"dfn","url":"#utf-8-decode-without-bom-or-fail"}, "#utf-8-decoder": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"utf-8 decoder","type":"dfn","url":"#utf-8-decoder"}, "#utf-8-encode": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"utf-8 encode","type":"dfn","url":"#utf-8-encode"}, "#utf-8-encoder": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"utf-8 encoder","type":"dfn","url":"#utf-8-encoder"}, "#utf-8-lower-boundary": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"utf-8 lower boundary","type":"dfn","url":"#utf-8-lower-boundary"}, "#utf-8-upper-boundary": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"utf-8 upper boundary","type":"dfn","url":"#utf-8-upper-boundary"}, "#windows-1250": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"windows-1250","type":"dfn","url":"#windows-1250"}, "#windows-1251": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"windows-1251","type":"dfn","url":"#windows-1251"}, "#windows-1252": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"windows-1252","type":"dfn","url":"#windows-1252"}, "#windows-1253": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"windows-1253","type":"dfn","url":"#windows-1253"}, "#windows-1254": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"windows-1254","type":"dfn","url":"#windows-1254"}, "#windows-1255": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"windows-1255","type":"dfn","url":"#windows-1255"}, "#windows-1256": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"windows-1256","type":"dfn","url":"#windows-1256"}, "#windows-1257": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"windows-1257","type":"dfn","url":"#windows-1257"}, "#windows-1258": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"windows-1258","type":"dfn","url":"#windows-1258"}, "#windows-874": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"windows-874","type":"dfn","url":"#windows-874"}, "#x-mac-cyrillic": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"x-mac-cyrillic","type":"dfn","url":"#x-mac-cyrillic"}, "#x-user-defined": {"export":true,"for_":[],"level":"","normative":true,"shortname":"encoding","spec":"encoding","status":"local","text":"x-user-defined","type":"dfn","url":"#x-user-defined"}, "https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"in parallel","type":"dfn","url":"https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel"}, "https://html.spec.whatwg.org/multipage/webappapis.html#event-loop": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"html","spec":"html","status":"current","text":"event loop","type":"dfn","url":"https://html.spec.whatwg.org/multipage/webappapis.html#event-loop"}, "https://infra.spec.whatwg.org/#ascii-byte": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"ascii byte","type":"dfn","url":"https://infra.spec.whatwg.org/#ascii-byte"}, "https://infra.spec.whatwg.org/#ascii-case-insensitive": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"ascii case-insensitive","type":"dfn","url":"https://infra.spec.whatwg.org/#ascii-case-insensitive"}, "https://infra.spec.whatwg.org/#ascii-code-point": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"ascii code point","type":"dfn","url":"https://infra.spec.whatwg.org/#ascii-code-point"}, "https://infra.spec.whatwg.org/#ascii-lowercase": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"ascii lowercase","type":"dfn","url":"https://infra.spec.whatwg.org/#ascii-lowercase"}, "https://infra.spec.whatwg.org/#ascii-whitespace": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"ascii whitespace","type":"dfn","url":"https://infra.spec.whatwg.org/#ascii-whitespace"}, "https://infra.spec.whatwg.org/#byte": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"byte","type":"dfn","url":"https://infra.spec.whatwg.org/#byte"}, "https://infra.spec.whatwg.org/#byte-sequence": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"byte sequence","type":"dfn","url":"https://infra.spec.whatwg.org/#byte-sequence"}, "https://infra.spec.whatwg.org/#byte-sequence-starts-with": {"export":true,"for_":["byte sequence"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"starts with","type":"dfn","url":"https://infra.spec.whatwg.org/#byte-sequence-starts-with"}, "https://infra.spec.whatwg.org/#code-point": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"code point","type":"dfn","url":"https://infra.spec.whatwg.org/#code-point"}, "https://infra.spec.whatwg.org/#code-point-value": {"export":true,"for_":["code point"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"value","type":"dfn","url":"https://infra.spec.whatwg.org/#code-point-value"}, "https://infra.spec.whatwg.org/#code-unit": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"code unit","type":"dfn","url":"https://infra.spec.whatwg.org/#code-unit"}, "https://infra.spec.whatwg.org/#iteration-break": {"export":true,"for_":["iteration"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"break","type":"dfn","url":"https://infra.spec.whatwg.org/#iteration-break"}, "https://infra.spec.whatwg.org/#iteration-continue": {"export":true,"for_":["iteration"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"continue","type":"dfn","url":"https://infra.spec.whatwg.org/#iteration-continue"}, "https://infra.spec.whatwg.org/#javascript-string-convert": {"export":true,"for_":["string","JavaScript string"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"convert","type":"dfn","url":"https://infra.spec.whatwg.org/#javascript-string-convert"}, "https://infra.spec.whatwg.org/#leading-surrogate": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"leading surrogate","type":"dfn","url":"https://infra.spec.whatwg.org/#leading-surrogate"}, "https://infra.spec.whatwg.org/#list": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"list","type":"dfn","url":"https://infra.spec.whatwg.org/#list"}, "https://infra.spec.whatwg.org/#list-append": {"export":true,"for_":["list"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"append","type":"dfn","url":"https://infra.spec.whatwg.org/#list-append"}, "https://infra.spec.whatwg.org/#list-contain": {"export":true,"for_":["list","stack","queue","set"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"contain","type":"dfn","url":"https://infra.spec.whatwg.org/#list-contain"}, "https://infra.spec.whatwg.org/#list-insert": {"export":true,"for_":["list","set"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"insert","type":"dfn","url":"https://infra.spec.whatwg.org/#list-insert"}, "https://infra.spec.whatwg.org/#list-is-empty": {"export":true,"for_":["list","stack","queue","set"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"is empty","type":"dfn","url":"https://infra.spec.whatwg.org/#list-is-empty"}, "https://infra.spec.whatwg.org/#list-item": {"export":true,"for_":["list","stack","queue","set"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"item","type":"dfn","url":"https://infra.spec.whatwg.org/#list-item"}, "https://infra.spec.whatwg.org/#list-iterate": {"export":true,"for_":["list","set"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"for each","type":"dfn","url":"https://infra.spec.whatwg.org/#list-iterate"}, "https://infra.spec.whatwg.org/#list-prepend": {"export":true,"for_":["list"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"prepend","type":"dfn","url":"https://infra.spec.whatwg.org/#list-prepend"}, "https://infra.spec.whatwg.org/#list-remove": {"export":true,"for_":["list","set"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"remove","type":"dfn","url":"https://infra.spec.whatwg.org/#list-remove"}, "https://infra.spec.whatwg.org/#list-size": {"export":true,"for_":["list","stack","queue","set"],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"size","type":"dfn","url":"https://infra.spec.whatwg.org/#list-size"}, "https://infra.spec.whatwg.org/#queue": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"queue","type":"dfn","url":"https://infra.spec.whatwg.org/#queue"}, "https://infra.spec.whatwg.org/#scalar-value": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"scalar value","type":"dfn","url":"https://infra.spec.whatwg.org/#scalar-value"}, "https://infra.spec.whatwg.org/#scalar-value-string": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"scalar value string","type":"dfn","url":"https://infra.spec.whatwg.org/#scalar-value-string"}, "https://infra.spec.whatwg.org/#string": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"string","type":"dfn","url":"https://infra.spec.whatwg.org/#string"}, "https://infra.spec.whatwg.org/#surrogate": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"surrogate","type":"dfn","url":"https://infra.spec.whatwg.org/#surrogate"}, "https://infra.spec.whatwg.org/#the-range": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"the range","type":"dfn","url":"https://infra.spec.whatwg.org/#the-range"}, "https://infra.spec.whatwg.org/#trailing-surrogate": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"infra","spec":"infra","status":"current","text":"trailing surrogate","type":"dfn","url":"https://infra.spec.whatwg.org/#trailing-surrogate"}, "https://streams.spec.whatwg.org/#chunk": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"streams","spec":"streams","status":"current","text":"chunk","type":"dfn","url":"https://streams.spec.whatwg.org/#chunk"}, "https://streams.spec.whatwg.org/#dom-generictransformstream-readable": {"export":true,"for_":["GenericTransformStream"],"level":"1","normative":true,"shortname":"streams","spec":"streams","status":"current","text":"readable","type":"attribute","url":"https://streams.spec.whatwg.org/#dom-generictransformstream-readable"}, "https://streams.spec.whatwg.org/#dom-generictransformstream-writable": {"export":true,"for_":["GenericTransformStream"],"level":"1","normative":true,"shortname":"streams","spec":"streams","status":"current","text":"writable","type":"attribute","url":"https://streams.spec.whatwg.org/#dom-generictransformstream-writable"}, "https://streams.spec.whatwg.org/#generictransformstream": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"streams","spec":"streams","status":"current","text":"GenericTransformStream","type":"interface","url":"https://streams.spec.whatwg.org/#generictransformstream"}, "https://streams.spec.whatwg.org/#generictransformstream-transform": {"export":true,"for_":["GenericTransformStream"],"level":"1","normative":true,"shortname":"streams","spec":"streams","status":"current","text":"transform","type":"dfn","url":"https://streams.spec.whatwg.org/#generictransformstream-transform"}, "https://streams.spec.whatwg.org/#readable-stream": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"streams","spec":"streams","status":"current","text":"readable stream","type":"dfn","url":"https://streams.spec.whatwg.org/#readable-stream"}, "https://streams.spec.whatwg.org/#readablestream": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"streams","spec":"streams","status":"current","text":"ReadableStream","type":"interface","url":"https://streams.spec.whatwg.org/#readablestream"}, "https://streams.spec.whatwg.org/#rs-pipe-through": {"export":true,"for_":["ReadableStream"],"level":"1","normative":true,"shortname":"streams","spec":"streams","status":"current","text":"pipeThrough(transform)","type":"method","url":"https://streams.spec.whatwg.org/#rs-pipe-through"}, "https://streams.spec.whatwg.org/#transformstream": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"streams","spec":"streams","status":"current","text":"TransformStream","type":"interface","url":"https://streams.spec.whatwg.org/#transformstream"}, "https://streams.spec.whatwg.org/#transformstream-enqueue": {"export":true,"for_":["TransformStream"],"level":"1","normative":true,"shortname":"streams","spec":"streams","status":"current","text":"enqueue","type":"dfn","url":"https://streams.spec.whatwg.org/#transformstream-enqueue"}, "https://streams.spec.whatwg.org/#transformstream-set-up": {"export":true,"for_":["TransformStream"],"level":"1","normative":true,"shortname":"streams","spec":"streams","status":"current","text":"set up","type":"dfn","url":"https://streams.spec.whatwg.org/#transformstream-set-up"}, "https://streams.spec.whatwg.org/#transformstream-set-up-flushalgorithm": {"export":true,"for_":["TransformStream/set up"],"level":"1","normative":true,"shortname":"streams","spec":"streams","status":"current","text":"flushalgorithm","type":"dfn","url":"https://streams.spec.whatwg.org/#transformstream-set-up-flushalgorithm"}, "https://streams.spec.whatwg.org/#transformstream-set-up-transformalgorithm": {"export":true,"for_":["TransformStream/set up"],"level":"1","normative":true,"shortname":"streams","spec":"streams","status":"current","text":"transformalgorithm","type":"dfn","url":"https://streams.spec.whatwg.org/#transformstream-set-up-transformalgorithm"}, "https://streams.spec.whatwg.org/#writable-stream": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"streams","spec":"streams","status":"current","text":"writable stream","type":"dfn","url":"https://streams.spec.whatwg.org/#writable-stream"}, "https://webidl.spec.whatwg.org/#AllowShared": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"AllowShared","type":"extended-attribute","url":"https://webidl.spec.whatwg.org/#AllowShared"}, "https://webidl.spec.whatwg.org/#AllowSharedBufferSource": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"AllowSharedBufferSource","type":"typedef","url":"https://webidl.spec.whatwg.org/#AllowSharedBufferSource"}, "https://webidl.spec.whatwg.org/#NewObject": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"NewObject","type":"extended-attribute","url":"https://webidl.spec.whatwg.org/#NewObject"}, "https://webidl.spec.whatwg.org/#arraybufferview-write": {"export":true,"for_":["ArrayBufferView"],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"write","type":"dfn","url":"https://webidl.spec.whatwg.org/#arraybufferview-write"}, "https://webidl.spec.whatwg.org/#arraybufferview-write-startingoffset": {"export":true,"for_":["ArrayBufferView/write"],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"startingoffset","type":"dfn","url":"https://webidl.spec.whatwg.org/#arraybufferview-write-startingoffset"}, "https://webidl.spec.whatwg.org/#buffersource-byte-length": {"export":true,"for_":["BufferSource"],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"byte length","type":"dfn","url":"https://webidl.spec.whatwg.org/#buffersource-byte-length"}, "https://webidl.spec.whatwg.org/#dfn-convert-ecmascript-to-idl-value": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"converted to an idl value","type":"dfn","url":"https://webidl.spec.whatwg.org/#dfn-convert-ecmascript-to-idl-value"}, "https://webidl.spec.whatwg.org/#dfn-get-buffer-source-copy": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"get a copy of the buffer source","type":"dfn","url":"https://webidl.spec.whatwg.org/#dfn-get-buffer-source-copy"}, "https://webidl.spec.whatwg.org/#dfn-throw": {"export":true,"for_":["exception"],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"throw","type":"dfn","url":"https://webidl.spec.whatwg.org/#dfn-throw"}, "https://webidl.spec.whatwg.org/#exceptiondef-rangeerror": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"RangeError","type":"exception","url":"https://webidl.spec.whatwg.org/#exceptiondef-rangeerror"}, "https://webidl.spec.whatwg.org/#exceptiondef-typeerror": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"TypeError","type":"exception","url":"https://webidl.spec.whatwg.org/#exceptiondef-typeerror"}, "https://webidl.spec.whatwg.org/#idl-ArrayBuffer": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"ArrayBuffer","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-ArrayBuffer"}, "https://webidl.spec.whatwg.org/#idl-DOMString": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"DOMString","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-DOMString"}, "https://webidl.spec.whatwg.org/#idl-USVString": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"USVString","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-USVString"}, "https://webidl.spec.whatwg.org/#idl-Uint32Array": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"Uint32Array","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-Uint32Array"}, "https://webidl.spec.whatwg.org/#idl-Uint8Array": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"Uint8Array","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-Uint8Array"}, "https://webidl.spec.whatwg.org/#idl-boolean": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"boolean","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-boolean"}, "https://webidl.spec.whatwg.org/#idl-unsigned-long-long": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"unsigned long long","type":"interface","url":"https://webidl.spec.whatwg.org/#idl-unsigned-long-long"}, "https://webidl.spec.whatwg.org/#new": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"new","type":"dfn","url":"https://webidl.spec.whatwg.org/#new"}, "https://webidl.spec.whatwg.org/#this": {"export":true,"for_":[],"level":"1","normative":true,"shortname":"webidl","spec":"webidl","status":"current","text":"this","type":"dfn","url":"https://webidl.spec.whatwg.org/#this"}, }; function mkRefHint(link, ref) { const linkText = link.textContent; let dfnTextElements = ''; if (ref.text != linkText) { dfnTextElements = mk.li({}, mk.b({}, "Term: "), mk.span({}, ref.text) ); } const forList = ref.for_; let forListElements; if(forList.length == 0) { forListElements = []; } else if(forList.length == 1) { forListElements = mk.li({}, mk.b({}, "For: "), mk.span({}, forList[0]), ); } else { forListElements = mk.li({}, mk.b({}, "For: "), mk.ul({}, ...forList.map(forItem => mk.li({}, mk.span({}, forItem) ), ), ), ); } const url = ref.url; const safeUrl = encodeURIComponent(url); const hintPanel = mk.aside({ class: "ref-hint", id: `ref-hint-for-${safeUrl}`, "data-for": url, "aria-labelled-by": `ref-hint-for-${safeUrl}`, }, mk.ul({}, dfnTextElements, mk.li({}, mk.b({}, "URL: "), mk.a({ href: url, class: "ref" }, url), ), mk.li({}, mk.b({}, "Type: "), mk.span({}, `${ref.type}`), ), mk.li({}, mk.b({}, "Spec: "), mk.span({}, `${ref.spec ? ref.spec : ''}`), ), forListElements ), ); hintPanel.forLink = link; setupRefHintEventListeners(link, hintPanel); return hintPanel; } function hideAllRefHints() { queryAll(".ref-hint").forEach(el=>hideRefHint(el)); } function hideRefHint(refHint) { const link = refHint.forLink; link.setAttribute("aria-expanded", "false"); if(refHint.teardownEventListeners) { refHint.teardownEventListeners(); } refHint.remove(); } function showRefHint(link) { if(link.classList.contains("dfn-link")) return; const url = link.getAttribute("href"); const ref = refsData[url]; if(!ref) return; hideAllRefHints(); // Only display one at this time. const refHint = mkRefHint(link, ref); append(document.body, refHint); link.setAttribute("aria-expanded", "true"); positionRefHint(refHint); } function setupRefHintEventListeners(link, refHint) { if (refHint.teardownEventListeners) return; // Add event handlers to hide the refHint after the user moves away // from both the link and refHint, if not hovering either within one second. let timeout = null; const startHidingRefHint = (event) => { if (timeout) { clearTimeout(timeout); } timeout = setTimeout(() => { hideRefHint(refHint); }, 1000); } const resetHidingRefHint = (event) => { if (timeout) clearTimeout(timeout); timeout = null; }; link.addEventListener("mouseleave", startHidingRefHint); link.addEventListener("mouseenter", resetHidingRefHint); link.addEventListener("blur", startHidingRefHint); link.addEventListener("focus", resetHidingRefHint); refHint.addEventListener("mouseleave", startHidingRefHint); refHint.addEventListener("mouseenter", resetHidingRefHint); refHint.addEventListener("blur", startHidingRefHint); refHint.addEventListener("focus", resetHidingRefHint); refHint.teardownEventListeners = () => { // remove event listeners resetHidingRefHint(); link.removeEventListener("mouseleave", startHidingRefHint); link.removeEventListener("mouseenter", resetHidingRefHint); link.removeEventListener("blur", startHidingRefHint); link.removeEventListener("focus", resetHidingRefHint); refHint.removeEventListener("mouseleave", startHidingRefHint); refHint.removeEventListener("mouseenter", resetHidingRefHint); refHint.removeEventListener("blur", startHidingRefHint); refHint.removeEventListener("focus", resetHidingRefHint); }; } function positionRefHint(refHint) { const link = refHint.forLink; const linkPos = getBounds(link); refHint.style.top = linkPos.bottom + "px"; refHint.style.left = linkPos.left + "px"; const panelPos = refHint.getBoundingClientRect(); const panelMargin = 8; const maxRight = document.body.parentNode.clientWidth - panelMargin; if (panelPos.right > maxRight) { const overflowAmount = panelPos.right - maxRight; const newLeft = Math.max(panelMargin, linkPos.left - overflowAmount); refHint.style.left = newLeft + "px"; } } // TODO: shared util // Returns the root-level absolute position {left and top} of element. function getBounds(el, relativeTo=document.body) { const relativeRect = relativeTo.getBoundingClientRect(); const elRect = el.getBoundingClientRect(); const top = elRect.top - relativeRect.top; const left = elRect.left - relativeRect.left; return { top, left, bottom: top + elRect.height, right: left + elRect.width, } } function showRefHintListener(e) { // If the target isn't in a link (or is a link), // just ignore it. let link = e.target.closest("a"); if(!link) return; // If the target is in a ref-hint panel // (aka a link in the already-open one), // also just ignore it. if(link.closest(".ref-hint")) return; // Otherwise, show the panel for the link. showRefHint(link); } function hideAllHintsListener(e) { // If the click is inside a ref-hint panel, ignore it. if(e.target.closest(".ref-hint")) return; // Otherwise, close all the current panels. hideAllRefHints(); } document.addEventListener("DOMContentLoaded", () => { document.body.addEventListener("mousedown", showRefHintListener); document.body.addEventListener("focus", showRefHintListener); document.body.addEventListener("click", hideAllHintsListener); }); window.addEventListener("resize", () => { // Hide any open ref hint. hideAllRefHints(); }); } </script>

Pages: 1 2 3 4 5 6 7 8 9 10