[wp-trac] [WordPress Trac] #34096: Failed to set charset

WordPress Trac noreply at wordpress.org
Thu Dec 3 13:57:10 UTC 2015


#34096: Failed to set charset
-----------------------------------------+------------------------------
 Reporter:  kolorafa                     |       Owner:
     Type:  defect (bug)                 |      Status:  new
 Priority:  normal                       |   Milestone:  Awaiting Review
Component:  Database                     |     Version:  trunk
 Severity:  normal                       |  Resolution:
 Keywords:  reporter-feedback has-patch  |     Focuses:
-----------------------------------------+------------------------------

Comment (by pento):

 Ah, I suspect what is happening is that `mysqli_set_charset()` checks
 whether the client library supports `utf8mb4` before it sets the
 connection character set, whereas `SET NAMES` will just set it regardless.

 In the case of your test, `mysqli_set_charset()` failing causes the
 connection to fall back to `latin1`, but `SET NAMES` "works", because
 you're only sending 3 byte characters, which will work even if your client
 doesn't support `utf8mb4`.

 What version does `mysqli_get_client_info()` return on your server?

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


More information about the wp-trac mailing list