diff options
| author | Adam Mathes <adam@adammathes.com> | 2026-02-14 14:46:37 -0800 |
|---|---|---|
| committer | Adam Mathes <adam@adammathes.com> | 2026-02-14 14:46:37 -0800 |
| commit | afa87af01c79a9baa539f2992d32154d2a4739bd (patch) | |
| tree | 92c7416db734270a2fee1d72ee9cc119379ff8e1 /vanilla/node_modules/html-encoding-sniffer/README.md | |
| parent | 3b927e84d200402281f68181cd4253bc77e5528d (diff) | |
| download | neko-afa87af01c79a9baa539f2992d32154d2a4739bd.tar.gz neko-afa87af01c79a9baa539f2992d32154d2a4739bd.tar.bz2 neko-afa87af01c79a9baa539f2992d32154d2a4739bd.zip | |
task: delete vanilla js prototype\n\n- Removed vanilla/ directory and web/dist/vanilla directory\n- Updated Makefile, Dockerfile, and CI workflow to remove vanilla references\n- Cleaned up web/web.go to remove vanilla embed and routes\n- Verified build and tests pass\n\nCloses NK-2tcnmq
Diffstat (limited to 'vanilla/node_modules/html-encoding-sniffer/README.md')
| -rw-r--r-- | vanilla/node_modules/html-encoding-sniffer/README.md | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/vanilla/node_modules/html-encoding-sniffer/README.md b/vanilla/node_modules/html-encoding-sniffer/README.md deleted file mode 100644 index c2e1e0f..0000000 --- a/vanilla/node_modules/html-encoding-sniffer/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# Determine the Encoding of a HTML Byte Stream - -This package implements the HTML Standard's [encoding sniffing algorithm](https://html.spec.whatwg.org/multipage/syntax.html#encoding-sniffing-algorithm) in all its glory. The most interesting part of this is how it pre-scans the first 1024 bytes in order to search for certain `<meta charset>`-related patterns. - -```js -const htmlEncodingSniffer = require("html-encoding-sniffer"); -const fs = require("fs"); - -const htmlBytes = fs.readFileSync("./html-page.html"); -const sniffedEncoding = htmlEncodingSniffer(htmlBytes); -``` - -The passed bytes are given as a `Uint8Array`; the Node.js `Buffer` subclass of `Uint8Array` will also work, as shown above. - -The returned value will be a canonical [encoding name](https://encoding.spec.whatwg.org/#names-and-labels) (not a label). You might then combine this with the [`@exodus/bytes`](https://github.com/ExodusOSS/bytes/) package to decode the result: - -```js -const { TextDecoder } = require("@exodus/bytes"); -const htmlString = (new TextDecoder(sniffedEncoding)).decode(htmlBytes); -``` - -## Options - -You can pass the following options to `htmlEncodingSniffer`: - -```js -const sniffedEncoding = htmlEncodingSniffer(htmlBytes, { - xml, - transportLayerEncodingLabel, - defaultEncoding, -}); -``` - -The `xml` option is a boolean, defaulting to `false`. If set to `true`, then we bypass the [HTML encoding sniffing algorithm](https://html.spec.whatwg.org/multipage/syntax.html#encoding-sniffing-algorithm) and compute the encoding based on the presence of a BOM, or the other options provided. (In the future, we may perform sniffing of the `<?xml?>` declaration, but for now that is not implemented.) - -The `transportLayerEncodingLabel` is an encoding label that is obtained from the "transport layer" (probably a HTTP `Content-Type` header), which overrides everything but a BOM. - -The `defaultEncoding` is the ultimate fallback encoding used if no valid encoding is supplied by the transport layer, and no encoding is sniffed from the bytes. For HTML, it defaults to `"windows-1252"`, as recommended by the algorithm's table of suggested defaults for "All other locales" (including the `en` locale). For XML, it defaults to `"UTF-8"`. - -## Credits - -This package was originally based on the excellent work of [@nicolashenry](https://github.com/nicolashenry), [in jsdom](https://github.com/tmpvar/jsdom/blob/16fd85618f2705d181232f6552125872a37164bc/lib/jsdom/living/helpers/encoding.js). It has since been pulled out into this separate package. |
