Skip to content

Support WordPress installs with non-UTF-8 charsets #855

@westonruter

Description

@westonruter

The AMP spec requires <meta charset="utf-8"> and this is naturally problematic for sites that still use a Latin1 charset. We need to do a few things:

  • For existing paired mode theme system, we'll need to use mb_convert_encoding() from the get_bloginfo('charset') to utf-8 when reading from the DB. We'll also need to forcibly add header( 'Content-Type: text/html; charset=utf-8' ) to override what WordPress is sending by default.
  • With canonical AMP, we'll be output buffering the response and so we could convert the encoding at the time of output. We'll still need to be wary of \AMP_DOM_Utils::get_dom_from_content() in how it is currently assuming UTF-8 content for the input.

https://github.com/Automattic/amp-wp/blob/e60cb152a50e2ffbf5504d41aee859ad1d0e0baa/includes/class-amp-theme-support.php#L192

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions