17488 Posts in 4473 Topics by 1978 members
| Go to End | Next > | |
| Author | Topic: | 71106 Views |
-
Re: Russian Unicode problem. What to do?

2 February 2008 at 8:21am
Hi, everyone! The problem with cyrillic characters in utf8 within SilverStripe may be caused by the default parameters of mysql5 of the majority of Russian servers offering shared hosting. The default encoding is set to 'cp1251', which is common for Russian language sites. It makes a lot of trouble with cyrillics output in unicode, when some of the characters appear unreadable.
One of the possible solution is to modify 3 files in SS distribution before installing it.1) install.php
2) sapphire/core/model/MySQLDatabase.php
3) sapphire/core/model/DB.phpRight after function of connection to the database you should insert the following code:
mysql_query ("set character_set_client='utf8'");
mysql_query ("set character_set_results='utf8'");
mysql_query ("set collation_connection='utf8_general_ci'");It made my Russian cyrillics characters appear correctly.
-
Re: Russian Unicode problem. What to do?

6 February 2008 at 12:54am
We solves our problem by installing a mysql5 server instead of mysql4.11.
-
Re: Russian Unicode problem. What to do?

10 February 2008 at 10:24pm
To Craneway:
Hi! I've got the same problem. But i couldn't figure out where exactly should i insert these lines.
Can't you make some examples? -
Re: Russian Unicode problem. What to do?

12 February 2008 at 2:54am Last edited: 12 February 2008 3:03am
Hi, I looked once again through the mysql docs, and figured that one should modify only sapphire/core/model/MySQLDatabase.php (if the site has been already installed) adding just one mysql_query which is the replacement for the 3 mentioned above.
Look at the lines starting with 38. The code should go like that:public function __construct($parameters) {
$this->dbConn = mysql_connect($parameters['server'], $parameters['username'], $parameters['password']);
$this->active = mysql_select_db($parameters['database'], $this->dbConn);
$this->database = $parameters['database'];
if(!$this->dbConn) {
$this->databaseError("Couldn't connect to MySQL database");
}
mysql_query ("SET CHARACTER SET utf8");
parent::__construct();
}
Are you using a shared hosting as well? If you need to install, you should create an empty database first, then go to phpmyadmin (or whatever you use) and manually set the db properties (encoding). Make sure you do that on an empty database, because when it already has data you won't be able to modify it.
Then modify your install.php in the function starting with the line 392:function requireMysqlConnection($server, $username, $password, $testDetails) {
$this->testing($testDetails);
$conn = @mysql_connect($server, $username, $password);
if($conn) {
return true;
/*
if(mysql_query("CREATE DATABASE testing123")) {
mysql_query("DROP DATABASE testing123");
return true;
} else {
$testDetails[2] .= " (user '$username' doesn't have CREATE DATABASE permissions.)";
$this->error($testDetails);
}
*/
} else {
$testDetails[2] .= ": " . mysql_error();
$this->error($testDetails);
}
mysql_query ("SET CHARACTER SET utf8");
}When you run the installer, you will get an error in the top of the page, but don't pay attention to this, just enter your db name, password etc. and click "recheck the requirements". Should work as magic.
Please, reply when done, just to make sure everything is OK. -
Re: Russian Unicode problem. What to do?

17 February 2008 at 10:04am
Thank you! It worked! áÿðÑÂøñþ!
-
Re: Russian Unicode problem. What to do?

6 March 2008 at 8:59pm Last edited: 6 March 2008 9:00pm
I have the same problem on my local Apache.
Prompt you it has decided?
I think that a problem in local server configuration, only I do not know what.
I allow the reference to the same problem in CMSMadeSimple , probably it will help
I want to try now to establish SilverStripe on Unix a hosting -
Re: Russian Unicode problem. What to do?

6 March 2008 at 9:23pm
Legallydead üþöõш ôþñðòøть üõýѠò ðÑÂьúу ?
ICQ 41151402 -
Re: Russian Unicode problem. What to do?

6 March 2008 at 9:31pm
Craneway
Thank you! It worked! áÿðÑÂøñþ!
| 71106 Views | ||
| Go to Top | Next > |


