polish language

Permalink
Helo guys.

I'm using concrete5 and its great i love it. but i have a litle problem.
Database default collation is latin1_swedish_ci , and site utf8 charset.

I need to translate concrete5 to polish language, so i set in database latin2_general_ci (Central European) collation the same connection collation. on the site charset=iso-8859-2. no polish leters only question marks :/ any ideas ?

 
frz replied on at Permalink Reply
frz
pdm replied on at Permalink Reply
On site utf-8

On Datebase:
Collation latin1_swedish_ci
MySQL charset: UTF-8 Unicode (utf8)
MySQL connection collation: utf8_bin

And SHOW VARIABLES LIKE "character_set%";
returns:
character_set_client utf8
character_set_connection utf8
character_set_database latin1
character_set_filesystem binary
character_set_results utf8
character_set_server latin1
character_set_system utf8
harunkaraman replied on at Permalink Reply 1 Attachment
harunkaraman
Run this script for your database, and you will see it fixed. The problem is, most likely you had your default charset set to .. swedish_ci. Later changing it to UTF-8 does not help. Because, C5 already created tenth of new tables which are not utf8 and you keep on adding to it. Sometimes, host providers does not watch the default charsets during upgrade.

After backing up your database, copy the content of below php code in a file. I also attached the file, rename the extension to PHP and run it.

Edit the database settings,

Run it with your browser.

Done!

=== PHP CODE BEGINS ===

<?php
$host=' '; //this is the database hostname, Do not change this.
$user=' '; //please set your mysql user name
$pass=' '; // please set your mysql user password
$dbname=' '; //please set your Database name
$charset='utf8'; // specify the character set
$collation='utf8_general_ci'; //specify what collation you wish to use

$db = mysql_connect('localhost',"$user","$pass") or die("mysql could not CONNECT to the database, in correct user or password " . mysql_error());
mysql_select_db("$dbname") or die("Mysql could not SELECT to the database, Please check your database name " . mysql_error());
$result=mysql_query('show tables') or die("Mysql could not execute the command 'show tables' " . mysql_error());
while($tables = mysql_fetch_array($result)) {
foreach ($tables as $key => $value) {
mysql_query("ALTER TABLE $value CONVERT TO CHARACTER SET $charset COLLATE $collation") or die("Could not convert the table " . mysql_error());
}}
mysql_query("ALTER DATABASE $dbname DEFAULT CHARACTER SET $charset COLLATE $collation") or die("could not alter the collation of the databse " . mysql_error());
echo "The collation of your database has been successfully changed!";
?>

=== PHP CODE END ===


You may contact us if you have any problem
http://www.kordil.com