setUTF() is not working ? (cautious of a multibyte)

General questions regarding the use of languages in Joomla! 2.5.

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.
Locked
yumikom
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Fri Sep 27, 2013 5:52 am

setUTF() is not working ? (cautious of a multibyte)

Post by yumikom » Thu May 29, 2014 5:26 am

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).

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: setUTF() is not working ? (cautious of a multibyte)

Post by infograf768 » Thu May 29, 2014 8:11 am

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.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

yumikom
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Fri Sep 27, 2013 5:52 am

Re: setUTF() is not working ? (cautious of a multibyte)

Post by yumikom » Wed Jun 04, 2014 7:54 am

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.

yumikom
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Fri Sep 27, 2013 5:52 am

Re: setUTF() is not working ? (cautious of a multibyte)

Post by yumikom » Wed Jun 04, 2014 8:53 am

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.

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: setUTF() is not working ? (cautious of a multibyte)

Post by infograf768 » Thu Jun 05, 2014 9:02 am

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
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

yumikom
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Fri Sep 27, 2013 5:52 am

Re: setUTF() is not working ? (cautious of a multibyte)

Post by yumikom » Fri Jun 06, 2014 7:15 am

I thank for your devoted support and great Joomla! community.

User avatar
Bakual
Joomla! Ace
Joomla! Ace
Posts: 1038
Joined: Sun Dec 13, 2009 9:00 pm
Location: Switzerland
Contact:

Re: setUTF() is not working ? (cautious of a multibyte)

Post by Bakual » Fri Jun 06, 2014 11:50 am


yumikom
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Fri Sep 27, 2013 5:52 am

Re: setUTF() is not working ? (cautious of a multibyte)

Post by yumikom » Tue Jun 17, 2014 6:47 am

It is the same as this code which I tested and It's working.

Thanks.

User avatar
Bakual
Joomla! Ace
Joomla! Ace
Posts: 1038
Joined: Sun Dec 13, 2009 9:00 pm
Location: Switzerland
Contact:

Re: setUTF() is not working ? (cautious of a multibyte)

Post by Bakual » Tue Jun 17, 2014 7:04 am

Can you please add a comment on the PR?

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: setUTF() is not working ? (cautious of a multibyte)

Post by infograf768 » Tue Jun 17, 2014 7:12 am

I merged, Thomas.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
Bakual
Joomla! Ace
Joomla! Ace
Posts: 1038
Joined: Sun Dec 13, 2009 9:00 pm
Location: Switzerland
Contact:

Re: setUTF() is not working ? (cautious of a multibyte)

Post by Bakual » Tue Jun 17, 2014 7:28 am

Even better :)


Locked

Return to “Language - Joomla! 2.5”