[wp-trac] [WordPress Trac] #61072: HTML API: Add custom text decoder
WordPress Trac
noreply at wordpress.org
Sun Jun 2 15:14:51 UTC 2024
#61072: HTML API: Add custom text decoder
-------------------------+----------------------
Reporter: dmsnell | Owner: dmsnell
Type: enhancement | Status: closed
Priority: normal | Milestone: 6.6
Component: HTML API | Version: trunk
Severity: normal | Resolution: fixed
Keywords: has-patch | Focuses:
-------------------------+----------------------
Changes (by dmsnell):
* owner: (none) => dmsnell
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"58281" 58281]:
{{{
#!CommitTicketReference repository="" revision="58281"
HTML API: Add custom text decoder.
Provides a custom decoder for strings coming from HTML attributes and
markup. This custom decoder is necessary because of deficiencies in
PHP's `html_entity_decode()` function:
- It isn't aware of 720 of the possible named character references in
HTML, leaving many out that should be translated.
- It isn't aware of the ambiguous ampersand rule, which allows
conversion of character references in certain contexts when they
are missing their closing `;`.
- It doesn't draw a distinction for the ambiguous ampersand rule
when decoding attribute values instead of markup values.
- Use of `html_entity_decode()` requires manually passing non-default
paramter values to ensure it decodes properly.
This decoder also provides some conveniences, such as making a
single-pass and interruptable decode operation possible. This will
provide a number of opportunities to optimize detection and decoding
of things like value prefixes, and whether a value contains a given
substring.
Developed in https://github.com/WordPress/wordpress-develop/pull/6387
Discussed in https://core.trac.wordpress.org/ticket/61072
Props dmsnell, gziolo, jonsurrell, jorbin, westonruter, zieladam.
Fixes #61072.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61072#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list