[wp-trac] [WordPress Trac] #37982: 4.6.1 Breaks apostrophes in titles and utf-8 characters

WordPress Trac noreply at wordpress.org
Thu Sep 8 10:54:52 UTC 2016


#37982: 4.6.1 Breaks apostrophes in titles and utf-8 characters
--------------------------+------------------------------
 Reporter:  edutz         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Charset       |     Version:  4.6.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by glafarge):

 Reverting to the previous version of
 [https://core.trac.wordpress.org/changeset/38442/branches/4.6/src/wp-
 includes/wp-db.php?old=38133&old_path=trunk%2Fsrc%2Fwp-includes%2Fwp-
 db.php wp-db.php] file resolves temporary the issue.

 Problem came from inside `set_charset()` function.

 As in Wordpress v4.6.1 the MySQL character set queries now depends on the
 `mysqli_set_charset()` success,
 `SET NAMES %s` will be never executed if it return false.

 In my case `mysqli_set_charset($dbh, 'utf8mb4')` return false because I
 think this function don't accepts unicode subsets (like utf8**mb4** that I
 use). See [http://dev.mysql.com/doc/refman/5.6/en/charset-charsets.html
 MySQL character sets].

 `set_charset()` function must deal with utf8**xxx** subsets to work
 properly.

 For example the follwing can resolve the issue :
 {{{#!php
 $mysqli_charset = (strpos($charset, 'utf8')!==false) ? 'utf8' : $charset;
 $set_charset_succeeded = mysqli_set_charset( $dbh, $mysqli_charset) ;
 }}}

 Maybe we must apply the same logic to the old MySQL extension part of the
 function.

 Tested with MySQL server v5.6.

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


More information about the wp-trac mailing list