Skip Menu |
 

This queue is for tickets about the DBD-mysql CPAN distribution.

Report information
The Basics
Id: 119079
Status: resolved
Priority: 0/
Queue: DBD-mysql

People
Owner: MICHIELB [...] cpan.org
Requestors: tzs [...] eacceleration.com
Cc: pali [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



MIME-Version: 1.0 (Mac OS X Mail 9.3 \(3124\))
X-Spam-Status: No, score=-2.001 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RP_MATCHES_RCVD=-0.001] autolearn=ham
X-Mailer: Apple Mail (2.3124)
X-Spam-Flag: NO
Message-ID: <A30FF02A-4B38-44DD-B21A-A8E7D92FB9F8 [...] eacceleration.com>
content-type: text/plain; charset="utf-8"
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Virus-Scanned: Debian amavisd-new at vm-svcml153.hmk.internal.eacceleration.com
X-Spam-Score: -2.001
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id C64302401C0 for <cpan-bug+DBD-mysql [...] hipster.bestpractical.com>; Wed, 30 Nov 2016 15:18:36 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1Ii5aItjlXEA for <cpan-bug+DBD-mysql [...] hipster.bestpractical.com>; Wed, 30 Nov 2016 15:18:35 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 4EEE1240079 for <bug-DBD-mysql [...] rt.cpan.org>; Wed, 30 Nov 2016 15:18:35 -0500 (EST)
Received: (qmail 17882 invoked by alias); 30 Nov 2016 20:18:34 -0000
Received: from hmkgw.eacceleration.com (HELO hmkgw.eacceleration.com) (50.78.160.185) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Wed, 30 Nov 2016 12:18:31 -0800
Received: from localhost (vm-svcml153.hmk.internal.eacceleration.com [127.0.0.1]) by vm-svcml153.hmk.internal.eacceleration.com (Postfix) with ESMTP id CEC27205D9 for <bug-DBD-mysql [...] rt.cpan.org>; Wed, 30 Nov 2016 20:18:24 +0000 (UTC)
Received: from vm-svcml153.hmk.internal.eacceleration.com ([127.0.0.1]) by localhost (vm-svcml153.hmk.internal.eacceleration.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id DZ1Vt531fP09 for <bug-DBD-mysql [...] rt.cpan.org>; Wed, 30 Nov 2016 20:18:24 +0000 (UTC)
Received: from timsmith2.hostmark.eacceleration.com (timsmith2.hostmark.eacceleration.com [10.5.0.77]) by vm-svcml153.hmk.internal.eacceleration.com (Postfix) with ESMTPS id A9E0020307 for <bug-DBD-mysql [...] rt.cpan.org>; Wed, 30 Nov 2016 20:18:24 +0000 (UTC)
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] eacceleration.com
Delivered-To: cpan-bug+DBD-mysql [...] hipster.bestpractical.com
Subject: unexpected handling of mysql_enable_utf8/mysql_enable_utf8 => 0
Return-Path: <tzs [...] eacceleration.com>
X-RT-Mail-Extension: dbd-mysql
X-Original-To: cpan-bug+DBD-mysql [...] hipster.bestpractical.com
X-Spam-Check-BY: la.mx.develooper.com
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= eacceleration.com; h=x-mailer:mime-version:date:date:message-id :subject:subject:content-transfer-encoding:content-type :content-type:from:from:received:received; s=vm-svcml153; t= 1480537104; x=1482351505; bh=aD1uAzQktd21GcuK0Y1R4djmkuYfAAkHYcD k1ZcbT5k=; b=OqD0Wcf22seOyNSfZFBZutqSWqZr9CqTMgwj0ofPbS9SFcu/r9V a7a+cAy7gPF4fd8vD1MQGP3cCfExAEIgCpjTnEQ1+FbXq27AtoBlrgTTNLqrX+Ib ljcp45xuD7NaxNuwpYjsBRDne+H3Xh99i/G+eMxdKtEO8YBkT3A1AGlE=
Date: Wed, 30 Nov 2016 12:18:24 -0800
X-Spam-Level:
To: bug-DBD-mysql [...] rt.cpan.org
Content-Transfer-Encoding: quoted-printable
From: Tim Smith <tzs [...] eacceleration.com>
X-RT-Original-Encoding: ascii
X-RT-Interface: Email
Content-Length: 1860
Download (untitled) / with headers
text/plain 1.8k
At line 1884 of dbdimp.c, it handles the mysql_enable_utf8/mysql_enable_utf8mb4 flags in the options hash: if ((svp = hv_fetch(hv, "mysql_enable_utf8mb4", 20, FALSE)) && *svp && SvTRUE(*svp)) { mysql_options(sock, MYSQL_SET_CHARSET_NAME, "utf8mb4"); } else if ((svp = hv_fetch(hv, "mysql_enable_utf8", 17, FALSE)) && *svp) { /* Do not touch imp_dbh->enable_utf8 as we are called earlier * than it is set and mysql_options() must be before: * mysql_real_connect() */ mysql_options(sock, MYSQL_SET_CHARSET_NAME, (SvTRUE(*svp) ? "utf8" : "latin1")); if (DBIc_TRACE_LEVEL(imp_xxh) >= 2) PerlIO_printf(DBIc_LOGPIO(imp_xxh), "mysql_options: MYSQL_SET_CHARSET_NAME=%s\n", (SvTRUE(*svp) ? "utf8" : "latin1")); } The logic here leads to surprising results. If when connecting you give this: mysql_enable_utf8mb4 => 1 you get MYSQL_SET_CHARSET_NAME set to utf8mb4, as you would expect, . Similarly, mysql_enable_utf8 => 1 gives MYSQL_SET_CHARSET_NAME set to utf8, just as expected, and not specifying either option results in MYSQL_SET_CHARSET_NAME not being set so you presumably get whatever the underlying mysql default is. Where it gets weird is if you give one of these: mysql_enable_utf8mb4 => 0 or mysql_enable_utf8 => 0. The former is equivalent to not specifying an option, and so you get the underlying mysql default for MYSQL_SET_CHARSET_NAME. The later, however, results in MYSQL_SET_CHARSET_NAME set to latin1. It seems quite counterintuitive that if I want latin1, the way to get it is with mysql_enable_utf8 => 0, and mysql_enable_utf8mb4 => 0 will not get that (unless that happens to be the underlying default). -- Tim Smith tzs@eacceleration.com
MIME-Version: 1.0
In-Reply-To: <A30FF02A-4B38-44DD-B21A-A8E7D92FB9F8 [...] eacceleration.com>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <A30FF02A-4B38-44DD-B21A-A8E7D92FB9F8 [...] eacceleration.com>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-1428-1480579970-1239.119079-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 474
Download (untitled) / with headers
text/plain 474b
Hi Tim! On Wed 30 Nov 2016 15:18:37, tzs@eacceleration.com wrote: Show quoted text
> It seems quite counterintuitive that if I want latin1, the way to get > it is with mysql_enable_utf8 => 0, and mysql_enable_utf8mb4 => 0 will > not get that (unless that happens to be the underlying default).
You're right on that! Also, the behaviour of mysql_enable_utf8 => 0 is not documented. My proposal would be to explicitly document this behavior and leave it at that. Do you agree? -- Michiel
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-1428-1480579970-1239.119079-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <A30FF02A-4B38-44DD-B21A-A8E7D92FB9F8 [...] eacceleration.com> <rt-4.0.18-1428-1480579970-1239.119079-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-9976-1488374763-1212.119079-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 875
Download (untitled) / with headers
text/plain 875b
On Štv Dec 01 03:12:50 2016, MICHIELB wrote: Show quoted text
> Hi Tim! > > On Wed 30 Nov 2016 15:18:37, tzs@eacceleration.com wrote: >
> > It seems quite counterintuitive that if I want latin1, the way to get > > it is with mysql_enable_utf8 => 0, and mysql_enable_utf8mb4 => 0 will > > not get that (unless that happens to be the underlying default).
> > > You're right on that! Also, the behaviour of mysql_enable_utf8 => 0 is > not documented. > > My proposal would be to explicitly document this behavior and leave it > at that. Do you agree? > > -- > Michiel
If mysql_enable_utf8 is not specified then default encoding (probably announced by server?) is used. I think we should explicitly set latin1 as default even if mysql_enable_utf8 is not set. That would at least make DBD::mysql deterministic on different machines, where are different default values... What do you think?
X-RT-Interface: REST
MIME-Version: 1.0
X-Mailer: MIME-tools 5.504 (Entity 5.504)
RT-Message-ID: <rt-4.0.18-6098-1510732535-606.119079-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 78


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.