From bcc048cde7244fc2b646fda6badc14499b130f69 Mon Sep 17 00:00:00 2001 From: sparrow <176383@protonmail.com> Date: Wed, 25 Nov 2026 20:18:00 +0400 Subject: [PATCH 1/3] Use consistent name for character encoding concept HTML specification refers to character encoding as "character encoding" instead of simply "encoding". Although the intent to disambiguate "character encoding" from other kinds of encodings is understandable, it creates a confusion, when a reference is made to the Document object in DOM which has `encoding` field, but no `character encoding` field. There's no need to redefine that unspecified "encoding" means "character encoding" in most cases, as all specifications refer to "character encoding" simply as "encoding", beginning with the Encoding specification. If there is a need to specifcally call "encoding" as a "character encoding", this can be done with an additional "character" word outside the cross-referenced part of the phrase. --- source | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/source b/source index 9e951ede425..d5e5720864b 100644 --- a/source +++ b/source @@ -3568,7 +3568,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute type and callback -
Let encoding be UTF-8.
If environment is a Document object, then set encoding
- to environment's character
+ to environment's
encoding.
Otherwise, if environment's relevant global object is a
Window object, set encoding to environment's relevant
global object's associated
- Document's character
+ Document's
encoding.
Let baseURL be environment's base
@@ -16694,7 +16694,7 @@ interface HTMLBaseElement : HTMLElement {
Let urlRecord be the result of parsing the
value of element's href content attribute with
document's fallback base URL, and document's character encoding. (Thus, the base
+ data-x="document's encoding">encodingbase
element isn't affected by itself.)
Let urlRecord be the result of parsing
url with document's fallback base URL, and
- document's character encoding.
+ document's encoding.
(Thus, the base element isn't affected by other base elements or
itself.)
The document's encoding will +
The document's encoding will
be left as its default, of UTF-8. In particular, any XML declarations or
meta elements found while parsing compliantString will have no effect.
Document.
Note that script elements are not evaluated during parsing, and the resulting
- document's encoding will always be
+ document's encoding will always be
UTF-8. The document's URL will be
about:blank. If options is a ParseHTMLUnsafeOptions
dictionary containing a sanitizer
@@ -143314,7 +143314,7 @@ dictionary StorageEventInit : EventInit {
If parentDocument's origin is same origin with d's origin and parentDocument's character encoding is not + data-x="document's encoding">encoding is not UTF-16BE/LE, then return parentDocument's character encoding, with the confidence tentative.
utf-8". Regardless of whether a
- character encoding declaration is present or not, the actual character encoding used to encode the document must be
+ character encoding declaration is present or not, the actual encoding used to encode the document must be
UTF-8. ENCODING
To enforce the above rules, authoring tools must default to using UTF-8 @@ -19207,7 +19206,7 @@ people expect to have work and what is necessary. characters entered by the user in forms, in URLs generated by scripts, and so forth.
Using non-UTF-8 encodings can have unexpected results on form submission and URL encodings, - which use the document's character encoding by default.
+ which use the document's encoding by default.If the document is an iframe srcdoc
@@ -30301,7 +30300,7 @@ document.body.appendChild(wbr);
get an encoding from that attribute's value. If
that succeeds, return the resulting encoding. ENCODING
Otherwise, return the document's character encoding. +
Otherwise, return the document's encoding. DOM
Let encoding be the document's character encoding.
Let encoding be the document's encoding.
If the form element has an Location { // but see also Basic URL parse input, with null, the
- relevant Document's document's character encoding,
+ relevant Document's document's encoding,
copyURL as url, and query
state as state
override.
The actual HTTP headers and other metadata, not the headers as mutated or implied by the algorithms given in this specification, are the ones that must be used when determining the character encoding according to the rules given in the above specifications. Once the character - encoding is established, the document's character encoding must be set to that + encoding is established, the document's encoding must be set to that character encoding.
Before any script execution occurs, the user agent must wait for scripts may run for the
@@ -143258,7 +143257,7 @@ dictionary StorageEventInit : EventInit {
Although the decode algorithm will itself change the encoding to
use based on the presence of a byte order mark, this algorithm sniffs the BOM as well in order
- to set the correct document's character encoding and document's encoding and confidence.
The document's character encoding must immediately be set to the value returned +
The document's encoding must immediately be set to the value returned from this algorithm, at the same time as the user agent uses the returned value to select the decoder to use for the input byte stream.
@@ -144209,7 +144208,7 @@ dictionary StorageEventInit : EventInit {If all the bytes up to the last byte converted by the current decoder have the same Unicode interpretations in both the current encoding and the new encoding, and if the user agent supports changing the converter on the fly, then the user agent may change to the new converter - for the encoding on the fly. Set the document's character encoding and the encoding + for the encoding on the fly. Set the document's encoding and the encoding used to convert the input stream to the new encoding, set the confidence to certain, and return.
When the document's character encoding is ISO-8859-8, the following rules are +
When the document's encoding is ISO-8859-8, the following rules are additionally expected to apply, following those above: ENCODING
@namespace "http://www.w3.org/1999/xhtml";
@@ -159688,7 +159687,7 @@ interface External {
charset
The charset parameter may be provided to specify the
- document's character encoding, overriding any document's encoding, overriding any character encoding declarations in the document other than a Byte Order
Mark (BOM). The parameter's value must be an ASCII case-insensitive match for the
string "utf-8". ENCODING
From de44a77934fe50dd689dca9ac7fc7c231e550cf8 Mon Sep 17 00:00:00 2001
From: sparrow <176383@protonmail.com>
Date: Wed, 25 Nov 2026 21:12:34 +0400
Subject: [PATCH 3/3] Fix additional references
---
source | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/source b/source
index f5fff1a4131..132b02e2e01 100644
--- a/source
+++ b/source
@@ -143314,8 +143314,7 @@ dictionary StorageEventInit : EventInit {
same origin with d's origin and parentDocument's encoding is not
- UTF-16BE/LE, then return parentDocument's character encoding, with the UTF-16BE/LE, then return parentDocument's encoding, with the confidence tentative.