Skip to content

Conversation

@j0k3r
Copy link
Owner

@j0k3r j0k3r commented Jun 3, 2025

See #106

The fix introduced in efbbc86 alongside this test also manipulates `meta[charset]` but we were not checking if it does not break encoding.
jtojnar and others added 2 commits June 3, 2025 09:48
Because of PHP 8.2 deprecation, in f14428e, we stopped converting non-ASCII characters to HTML entities. Instead, we started to explicitly insert `meta[charset]` tag at the start of the document.

Later, we discovered that was breaking `html[lang]` so, in efbbc86, we made the insertion smarter. One of the improvements was that it would not insert the `meta[charset]` tag when it was already present.

That, however, broke websites that had `title` tag before `meta[charset]`. On those, libxml2 would decode the `title` contents as ISO-8859-1.

We could improve the logic (e.g. check that there is not text content before `meta[charset]`) or insert the tag unconditionally but it will probably be simplest to just go back to converting the non-ASCII characters to entities, just using non-deprecated function variant.
@j0k3r j0k3r force-pushed the backport/encode branch from 682b09f to a21742b Compare June 3, 2025 07:48
@j0k3r j0k3r merged commit b9dde0f into 1.x Jun 3, 2025
15 checks passed
@j0k3r j0k3r deleted the backport/encode branch June 3, 2025 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants