Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0b4

Bug #14005 Umlaute in Query cause a problem
Submitted: 2008-05-28 19:11 UTC
From: caddy Assigned: quipo
Status: Closed Package: MDB2_Driver_mysql (version 1.4.1)
PHP Version: 5.2.6 OS: WinXP
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 9 + 46 = ?

 
 [2008-05-28 19:11 UTC] caddy (Carsten Müller)
Description: ------------ We have a MySql (5.0.41-community-nt) database (database charset in latin1) containing tables in utf8_bin charset. I try to set a query : "select * from blablabla where name like 'Carsten Mü%';" This returns an empty recordset. I tried to set the charset to UTF8 but nothing works : $return =& $this->mdb2->query('SET NAMES utf8'); $return =& $this->mdb2->query('SET CHARACTER SET utf8'); $return =& $this->mdb2->setCharset('utf8'); // Achtung klappt nicht !!! Log : May 28 21:01:23 TEST [info] Carsten Mü May 28 21:01:23 TEST [info] SQL : SELECT USER_NAME, TEAM_NAME, land_anzeige, ligen_name FROM user, teams, laender, wt_ligen WHERE user.team_id = teams.team_id AND USER_NAME <> 'Gast' AND teams.land_id = laender.land_id AND teams.team_liga = wt_ligen.ligen_id AND USER_NAME like 'Carsten Mü%' ORDER BY USER_NAME asc LIMIT 0, 20 May 28 21:01:23 TEST [info] Arraycount ->>0<<- Data of the Database retreived is shown with "Umlaute" in the homepage. Only the Umlaut in the Statement causes trouble.

Comments

 [2008-05-28 19:17 UTC] quipo (Lorenzo Alberton)
Is this a MDB2 bug? Have you tried running the same query in mysql directly? Also, what charset did you use to put the data in the db? What is the table charset? And the database's? If you deal with different languages, I'd suggest to use a CONSISTENT setup at every level: db charset, table charset, connection charset.
 [2008-05-28 19:46 UTC] caddy (Carsten Müller)
Query (C&P) in the Database gaves the expected Result. Server variables and settings: 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 F:\Programme\xampplite\mysql\share\charsets\ collation connection utf8_unicode_ci (Global value) utf8_bin collation database utf8_bin collation server utf8_bin Database : os utf8_bin Check Privileges Table : user Browse Structure Search Insert Empty Drop 8 MyISAM utf8_bin 2.7 KiB Column : user_name varchar(30) utf8_bin No Browse distinct values Change Drop Primary Unique Index Fulltext I am not sure if its really an error, but i could not find any solution yet. Carsten
 [2008-05-28 19:51 UTC] caddy (Carsten Müller)
If I use a query like this : like 'Carsten M_ller%' I get my result !!... But this is not what I need in detail.
 [2008-05-28 20:00 UTC] caddy (Carsten Müller)
One more add : This helped me ! AND USER_NAME like _utf8'Carsten Mü%'
 [2008-05-28 20:32 UTC] quipo (Lorenzo Alberton)
That's what I suspected. You used a charset in the table definition (probably utf8) and the connection uses another one. As I said, make sure that all the parties are using the same charset: database default charset, table charset (you might need to recreate it, using the "DEFAULT CHARACTER SET xxx" syntax) and connection charset (SET NAMES xxx). http://dev.mysql.com/doc/refman/5.0/en/charset-database.html http://dev.mysql.com/doc/refman/5.0/en/charset-table.html ... If you use UTF-8 for all of them, you'll save yourself a lot of headaches.