Req #52453 [NEW]: Connection charset seems arbitrary
| From: | jeroen at asystance dot nl | Date: | Tue, 27 Jul 2010 09:00:12 +0000 |
| Subject: | Req #52453 [NEW]: Connection charset seems arbitrary | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-152832@lists.php.net to get a copy of this message | ||
From:
Operating system: Linux
PHP version: 5.3.3
Package: MySQLi related
Bug Type: Feature/Change Request
Bug description:Connection charset seems arbitrary
Description:
------------
The connection_charset used by a mysql/mysqli connection seems arbitrary -
at least I cannot figure out how it is determined. The documentation
provides no clues as to which charset is used by default.
I've tried connecting to different mysql servers from different shell
servers and can't figure out how the default charset is determined. As to
find out which one is used, open a mysql/mysqli (procedural or
object-oriented doesn't matter) connection and use mysql_client_encoding()
/ mysqli_get_charset() or "SHOW VARIABLES LIKE 'character_set%';" to find
out.
This probably is just a documentation problem, but maybe the default could
be chosen more sensibly: for example, the mysql server database's charset
seems the most sensible default.
For example, connecting from a shell that has en_US.UTF-8 as locale, I
get:
character_set_client: utf8
character_set_connection: utf8
character_set_database: utf8
character_set_filesystem: binary
character_set_results: utf8
character_set_server: utf8
character_set_system: utf8
character_sets_dir: /usr/share/mysql/charsets/
Switching to en_US.iso88591 doesn't change anything. So it would seem some
server setting determines the charset, right? However, connecting to the
same mysql server from another system (though from intranet instead of
internet), I get:
character_set_client: latin1
character_set_connection: latin1
character_set_database: utf8
character_set_filesystem: binary
character_set_results: latin1
character_set_server: utf8
character_set_system: utf8
character_sets_dir: /usr/share/mysql/charsets/
Again, the client locale doesn't influence this.
--
Edit bug report at http://bugs.php.net/bug.php?id=52453&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52453&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52453&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52453&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52453&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52453&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52453&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52453&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52453&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52453&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52453&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52453&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52453&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52453&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52453&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52453&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52453&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52453&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52453&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52453&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52453&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52453&r=mysqlcfg