[wp-trac] [WordPress Trac] #61072: HTML API: Add custom text decoder

WordPress Trac noreply at wordpress.org
Wed Apr 24 14:59:14 UTC 2024


#61072: HTML API: Add custom text decoder
-------------------------+-----------------------------
 Reporter:  dmsnell      |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  HTML API     |    Version:  trunk
 Severity:  normal       |   Keywords:  has-patch
  Focuses:               |
-------------------------+-----------------------------
 Provide 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.

 This decoder will also provide 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61072>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list