Last modified: 2011-03-13 18:04:31 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T9112, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 7112 - Wrong Encoding in mysql_client_encoding function within euckr mysql collation.
Wrong Encoding in mysql_client_encoding function within euckr mysql collation.
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
PC Linux
: Lowest major (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2006-08-24 05:12 UTC by simon Kim
Modified: 2011-03-13 18:04 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description simon Kim 2006-08-24 05:12:16 UTC
There is problem to encode using mysql_client_encoding() function in Database.php
So save wrong Article/Text everything that written in Korean.

PHP Version : 5.1.2
mysql version : mysql  Ver 14.7 Distrib 4.1.13, for pc-linux-gnu (i686) using
readline 4.3

mysql variables :
| character_set_client            | euckr                                      |
| character_set_connection        | euckr                                      |
| character_set_database          | euckr                                      |
| character_set_results           | euckr                                      |
| character_set_server            | euckr                                      |
| character_set_system            | utf8                                       |
| character_sets_dir              | /usr/local/mysql4113/share/mysql/charsets/ |
| collation_connection            | euckr_korean_ci                            |
| collation_database              | euckr_korean_ci                            |
| collation_server                | euckr_korean_ci                            |

Like this.
before mysql_client_encoding();
after mysql_client_encoding();

before mysql_client_encoding();
after mysql_client_encoding();
as this result.
can't find article and save wrong text in database.

But with mysql's collation/character_set_encoding is latin1, this is ok work well. 

i fixed this problem 

First install with option (for mysql4 or mysql5 using UTF8)
And then hange strencode function in Database.php, like this.
         * Wrapper for addslashes()
         * @param string $s String to be slashed.
         * @return string slashed string.
        function strencode( $s ) {
                //return mysql_real_escape_string( $s, $this->mConn );
                return addslashes( $s );
Comment 1 Rob Church 2006-08-24 10:19:07 UTC
The "workaround" described above is NOT safe for escaping all data prior to
insertion in the database and should not be replicated on other installations
without a good reason.
Comment 2 Brion Vibber 2006-08-29 11:47:52 UTC
Either you should use the default latin1 encoding, or you should use the UTF-8 schema with 
UTF-8 client mode enabled on MySQL 4.1 or higher. Nothing else is supported nor will it 
become supported.

Note You need to log in before you can comment on or make changes to this bug.