Make WordPress Core

Opened 6 weeks ago

Last modified 4 weeks ago

#66259 new feature request

Introduce WHATWG-compliant encoding name canonicalization.

Reported by: dmsnell Owned by:
Priority: normal Milestone: 7.3
Component: Charset Version:
Severity: normal Keywords: has-patch has-unit-tests dev-feedback
Cc: Focuses:

Description

WordPress largely treats character encoding names in an agnostic fashion, passing them off to browsers, iconv(), and mb_convert_encoding() transparently. This can lead to confusing data flow for text data, particularly because it’s unclear how arbitrary text coming into WordPress will be handled.

The ​ENCODING spec defines which character encodings should be supported by web-integrating systems and which variations of each encoding’s name should be treated as equivalent aliases.

For example, while l1 and us-ascii are both treated by browsers as windows-1252, they are never recognized as such within WordPress. In fact, since mb_convert_encoding() and iconv() don’t follow this interoperability standard, they fail for a number of supported encodings.

As WordPress moves towards deprecating non-UTF-8 support (#62172), it should provide robust mechanisms for converting text at the boundaries of input and output to aid this transition.

Prior work normalized UTF-8 detection in #61182, but focused on the detection of UTF-8 specifically, and without taking into account the additional encodings in the WHATWG standard.

Further work should provide standards-compliant canonicalization while being explicit which set of supported charsets is being detected. For instance, the set of mysql charset names is disjoint from the set of web standard charset names.

Activities requiring ENCODING support.

  • Decoding full HTML documents.
  • Reading and writing emails.
  • Printing <meta charset> tags.
  • Inferring MIME content type.

Related work

  • #64427 inferring MIME content type.

Change History (5)

This ticket was mentioned in ​PR #14055 on ​WordPress/wordpress-develop by ​@dmsnell.


6 weeks ago
#1

  • Keywords has-patch has-unit-tests added

Trac ticket: Core-66259

See wordpress/wordpress-develop#10640 (introduce MIME content type inference).

Introduces a character encoding name canonicalization, coupled with a decoder and encoder interface that code can call to reliably interact with web-standards byte streams and a provided encoding name.

This ticket was mentioned in ​Slack in #core by audrasjb. ​View the logs.


5 weeks ago

#3 @audrasjb
5 weeks ago

As per today's 7.2 bug scrub: This ticket will need a deep review, I'm unsure it's ready to ship before beta 1… still, I'm keeping it in the milestone until the first beta.

This ticket was mentioned in ​Slack in #core by audrasjb. ​View the logs.


4 weeks ago

#5 @audrasjb
4 weeks ago

  • Keywords dev-feedback added
  • Milestone 7.2 → 7.3

As per today's pre-7.2 beta1 bugscrub: moving to 7.3 as this is a Feature Request so it should have been committed before beta 1.

Note: See TracTickets for help on using tickets.