Subject: | UTF-8 column names and error messages are octet-streams, not strings |
Date: | Wed, 8 Feb 2017 12:42:41 +0900 |
To: | bug-DBD-mysql [...] rt.cpan.org |
From: | Tanabe Yoshinori <tanabe [...] fa2.so-net.ne.jp> |
Hello,
Column names and error messages should be treated as strings, but
they are octet-streams in DBD-mysql-4.041.
The attached code creates a table with a column whose name
contains a non ASCII character. After issueing a SELECT statement
and fetchrow_hashref, it tries to get a value using the column name
at (1), but the result is undef. If you use the octet stream for
the column name as a key, you get the value, at (2).
Also, when you use Japanese error messages by adding line
lc_messages=ja_JP
in [mysqld] section of my.ini, messages are not decoded in
DBD::mysql. As a result, messages are unreadable in (3) and (4).
We could explicitly decode them as in (5) for message caught, but
this cannot be applied to (3). Of course, it can be avoided by
not using automatic encoding for STDERR at (6), but then we need
to manually encode all other strings, a nightmare.
Finally, I noticed that when error messages are in Japanese, make
test of DBD-mysql fails. It may be difficult to avoid (I do not
know), but a warning message (lc_messages should not be changed)
in make test would help.
DBD::mysql version: 4.041
Strawberry perl 64bit, v5.22.1
MariaDB
$dbh->{mysql_clientinfo, mysql_clientversion, mysql_serverversion}
returns:
5.1.44, 50144, 50505, respectively.
Windows 7 Pro Service Pack 1
Regards,
Tanabe Yoshinori
Message body is not shown because sender requested not to inline it.