[wp-trac] [WordPress Trac] #7813: export function does not preserve encoding

WordPress Trac noreply at wordpress.org
Sun Jan 4 08:27:05 UTC 2026


#7813: export function does not preserve encoding
-------------------------------+-----------------------------
 Reporter:  tott               |       Owner:  tott
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Future Release
Component:  Export             |     Version:  2.7
 Severity:  minor              |  Resolution:
 Keywords:  2nd-opinion close  |     Focuses:
-------------------------------+-----------------------------

Old description:

> when exporting strings are always converted to utf-8 while header and
> encoding is set to encoding used in blog.
>
> this causes trouble when importing later.

New description:

 when exporting strings are always converted to utf-8 while header and
 encoding is set to encoding used in blog.

 this causes trouble when importing later.

 WordPress should always convert to UTF-8 and indicate this in the XML
 declaration and metadata.

--

Comment (by dmsnell):

 The WXR export //should// be UTF-8 because it’s an XML document.

 However, there are still things to improve here, but //none// of them
 should use `utf8_encode()`.

 It would be nice to see improvements in the export flow to convert into
 UTF-8, but that is definitely a complicated matter.

 For now it would be great if someone could clarify the behavior and ensure
 that WordPress does not indicate that the WXR is in the `blog_charset` or
 any other value than `utf-8`. @tott can you confirm if this is still a
 problem and explain more on the “header and encoding is set to encoding
 used in blog” part?

 The fix here is not preserving the charset because that will cause all
 sorts of trouble when attempting to import files. Note that this does not
 in any way depend on support for UTF-8 code or conversion functionality.
 If WordPress is unable to convert to UTF-8 from a known charset then it
 should produce an error of some kind.

 Eventually I hope to add full fallback support in #64473 which would give
 us the tools to do so reliably and safely regardless of which extensions
 are installed.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/7813#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list