setUTF() is not working ? (cautious of a multibyte)
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
-
- Joomla! Apprentice
- Posts: 8
- Joined: Fri Sep 27, 2013 5:52 am
setUTF() is not working ? (cautious of a multibyte)
I announce you the problem which I experienced.
The filter by title is not woking in backend article list.
A result is not obtained after I search a title by filter.
This problem is reproduced only when multibyte is inputted.
I found the cause.
Default character set was not set up correctly, when filter function was performed.
It was a problem of the default character set in MySQL controller.
The following core function.
/libraries/joomla/database/database/mysqli.php
function setUTF()
*This function is called when connecting with mysql.
original code
mysqli_query($this->connection, "SET NAMES 'utf8'");
changed code
mysqli_set_charset($this->connection, 'utf8');
The setting of default character set affects mysqli::real_escape_string.
"SET NAMES utf8" Will not affect $mysqli->real_escape_string()
Reference: http://php.net/manual/en/mysqlinfo.concepts.charset.php
I hope that a core package will be changed.
Thanks.
Using:
Joomla!2.5
Language: Japanese
PHP 5.4
MySQL: 5.5
MySQL client: MySQL Native Driver (mysqlnd)
*This problem does not occur in MySQL Client Library (libmysqlclient).
The filter by title is not woking in backend article list.
A result is not obtained after I search a title by filter.
This problem is reproduced only when multibyte is inputted.
I found the cause.
Default character set was not set up correctly, when filter function was performed.
It was a problem of the default character set in MySQL controller.
The following core function.
/libraries/joomla/database/database/mysqli.php
function setUTF()
*This function is called when connecting with mysql.
original code
mysqli_query($this->connection, "SET NAMES 'utf8'");
changed code
mysqli_set_charset($this->connection, 'utf8');
The setting of default character set affects mysqli::real_escape_string.
"SET NAMES utf8" Will not affect $mysqli->real_escape_string()
Reference: http://php.net/manual/en/mysqlinfo.concepts.charset.php
I hope that a core package will be changed.
Thanks.
Using:
Joomla!2.5
Language: Japanese
PHP 5.4
MySQL: 5.5
MySQL client: MySQL Native Driver (mysqlnd)
*This problem does not occur in MySQL Client Library (libmysqlclient).
- infograf768
- Joomla! Master
- Posts: 19133
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: setUTF() is not working ? (cautious of a multibyte)
Could you please paste here the characters/glyphs you have an issue with?
I can filter OK here article titles using Chinese or Japanese glyphs and we never heard from these users about any issue with mysqli and filtering titles.
Also, can you make a test with the version 3.3.0 of Joomla? The code used is slightly different there.
I can filter OK here article titles using Chinese or Japanese glyphs and we never heard from these users about any issue with mysqli and filtering titles.
Also, can you make a test with the version 3.3.0 of Joomla? The code used is slightly different there.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
-
- Joomla! Apprentice
- Posts: 8
- Joined: Fri Sep 27, 2013 5:52 am
Re: setUTF() is not working ? (cautious of a multibyte)
Thanks Master !
Japanese glyphs
article title 美術手帖
filter by title 美術
This is the first time that I also discovered this problem.
If time is got for a while, I can test with Jooml!3.3.0.
Japanese glyphs
article title 美術手帖
filter by title 美術
This is the first time that I also discovered this problem.
If time is got for a while, I can test with Jooml!3.3.0.
-
- Joomla! Apprentice
- Posts: 8
- Joined: Fri Sep 27, 2013 5:52 am
Re: setUTF() is not working ? (cautious of a multibyte)
I could with the version 3.3.0 of Joomla!
This problem did not happen with Joomla! 3.3. Search function in article list is working cool.
This problem is dependent on server environment. ( MySQL mysqlnd and PHP version )
I tested by the same server as a problem with Joomla!2.5x occurs.
Thanks.
This problem did not happen with Joomla! 3.3. Search function in article list is working cool.
This problem is dependent on server environment. ( MySQL mysqlnd and PHP version )
I tested by the same server as a problem with Joomla!2.5x occurs.
Thanks.
- infograf768
- Joomla! Master
- Posts: 19133
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: setUTF() is not working ? (cautious of a multibyte)
OK, I will let it know that mysqlnd is the culprit on 2.5
We could port back to 2.5 our 3.3 code
We could port back to 2.5 our 3.3 code
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
-
- Joomla! Apprentice
- Posts: 8
- Joined: Fri Sep 27, 2013 5:52 am
Re: setUTF() is not working ? (cautious of a multibyte)
I thank for your devoted support and great Joomla! community.
- Bakual
- Joomla! Ace
- Posts: 1038
- Joined: Sun Dec 13, 2009 9:00 pm
- Location: Switzerland
- Contact:
-
- Joomla! Apprentice
- Posts: 8
- Joined: Fri Sep 27, 2013 5:52 am
Re: setUTF() is not working ? (cautious of a multibyte)
It is the same as this code which I tested and It's working.
Thanks.
Thanks.
- Bakual
- Joomla! Ace
- Posts: 1038
- Joined: Sun Dec 13, 2009 9:00 pm
- Location: Switzerland
- Contact:
Re: setUTF() is not working ? (cautious of a multibyte)
Can you please add a comment on the PR?
- infograf768
- Joomla! Master
- Posts: 19133
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: setUTF() is not working ? (cautious of a multibyte)
I merged, Thomas.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
- Bakual
- Joomla! Ace
- Posts: 1038
- Joined: Sun Dec 13, 2009 9:00 pm
- Location: Switzerland
- Contact: