[wp-trac] [WordPress Trac] #63825: Creating a post containing UTF-8, then changing WP_CHARSET to "latin1", makes posts un-editable.

WordPress Trac noreply at wordpress.org
Mon Sep 22 22:29:13 UTC 2025


#63825: Creating a post containing UTF-8, then changing WP_CHARSET to "latin1",
makes posts un-editable.
-------------------------------------------------+-------------------------
 Reporter:  mcc111                               |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Database                             |     Version:  6.6.2
 Severity:  normal                               |  Resolution:
 Keywords:  needs-testing has-screenshots close  |     Focuses:  ui
  needs-test-info                                |
-------------------------------------------------+-------------------------

Comment (by dmsnell):

 @mcc111 what you show with `…` is evident of double-encoding content as
 UTF-8. That is, it was already UTF-8 and then it was encoded into UTF-8
 again, as if it was actually `latin1`.

 I wonder if any database tables might have been updated by your host at
 some point? Or some database migration took place?

 My guess is that something looked at the `DB_CHARSET` and thought it
 needed encoding //from// `latin1` //to// `UTF-8` when it was already in
 UTF-8.

 Unfortunately the reason #62172 is in part to acknowledge that this has
 almost always been broken in WordPress. PHP itself changed the internal
 encoding from `latin1` to `UTF-8` many years ago.

 1. Did you ever export and re-import your site to migrate it from one
 environment to another?
 2. Can you verify the collation of the database table and also show the
 raw `post_content` for one of the posts with the double-encoded UTF-8?

 It can be tricky knowing exactly what bytes are stored in the database
 because there are multiple levels of implicit text re-encoding in the
 process, but knowing what’s there could be a good start.

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


More information about the wp-trac mailing list