Joomla Intern. Edition do not display Cyrillic characters

General questions regarding the use of languages and encoding issues in Joomla! 1.0.x. Multi-lingual site solutions can be discussed in the child board. Translation discussions are now separate and can be found in the Working Groups Area.
Locked
Silanex
Joomla! Intern
Joomla! Intern
Posts: 70
Joined: Mon Mar 13, 2006 3:12 pm

Joomla Intern. Edition do not display Cyrillic characters

Post by Silanex » Sun Apr 13, 2008 8:44 pm

I installed Joomla International Edition which based on Joomla! 1.0.15 and offers a lot of improved functionality for multi-language users. This version is UTF-8 compatible and installs Joomla with a UTF-8 database.
I tried show both English and Cyrillic languages in one page, but it not display Cyrillic content, show symbols ??? ????. instead. Where is the problem?

Silanex
Joomla! Intern
Joomla! Intern
Posts: 70
Joined: Mon Mar 13, 2006 3:12 pm

P.S.: Joomla Intern. Edition do not display Cyrillic charact

Post by Silanex » Mon Apr 28, 2008 9:23 am

I solved this problem: that was MySQL database problem. My database collation was latin1_swedish_ci, not UTF-8. I installed Joomla correctly, but shared hosting I use has PHPMyAdmin partially disabled, so it even not possible to set correct database collation from PHPMyAdmin, and default collation is latin1_swedish_ci (and the database is created not from PHPMyAdmin).
So, the only possible way is to alter database to utf-8 collation. I just found PHP script that change all fields/tables to a different collation and run it against my database and this has helped.

Code: Select all

<?php
// this script will output the queries need to change all fields/tables to a different collation
// it is HIGHLY suggested you take a MySQL dump prior to running any of the generated
// this code is provided as is and without any warranty
die("Make a backup of your MySQL database then remove this line");
set_time_limit(0);
// collation you want to change:
$convert_from = 'latin1_swedish_ci';
// collation you want to change it to:
$convert_to = 'utf8_general_ci';
// character set of new collation:
$character_set= 'utf8';
$show_alter_table = true;
$show_alter_field = true;
// DB login information
$username = 'user';
$password = 'pass';
$database = 'table';
$host = 'localhost';
mysql_connect($host, $username, $password);
mysql_select_db($database);
$rs_tables = mysql_query(" SHOW TABLES ") or die(mysql_error());
print '<pre>';
while ($row_tables = mysql_fetch_row($rs_tables)) {
$table = mysql_real_escape_string($row_tables[0]);
// Alter table collation
// ALTER TABLE `account` DEFAULT CHARACTER SET utf8
if ($show_alter_table)
echo("ALTER TABLE `$table` DEFAULT CHARACTER SET $character_set;\r\n");
$rs = mysql_query(" SHOW FULL FIELDS FROM `$table` ") or die(mysql_error());
while ($row=mysql_fetch_assoc($rs)) {
if ($row['Collation']!=$convert_from)
continue;
// Is the field allowed to be null?
if ($row['Null']=='YES')
$nullable = ' NULL ';
else
$nullable = ' NOT NULL';
// Does the field default to null, a string, or nothing?
if ($row['Default']==NULL)
$default = " DEFAULT NULL";
else if ($row['Default']!='')
$default = " DEFAULT '".mysql_real_escape_string($row['Default'])."'";
else
$default = '';
// Alter field collation:
// ALTER TABLE `tab` CHANGE `fiel` `fiel` CHAR( 5 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL 
DEFAULT NULL
if ($show_alter_field) {
$field = mysql_real_escape_string($row['Field']);
echo "ALTER TABLE `$table` CHANGE `$field` `$field` $row[Type] CHARACTER SET $character_set COLLATE 
$convert_to $nullable $default; \r\n";
}
}
}
?>
When you set up MySQL database and assured that it has a wrong collation, then you probably can use this code to alter database(before installing Joomla):

Code: Select all

ALTER DATABASE `db_name` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Last edited by Silanex on Mon Apr 28, 2008 4:08 pm, edited 5 times in total.

amarketzone
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Thu Apr 24, 2008 6:23 am
Location: Romania
Contact:

Re: Joomla Intern. Edition do not display Cyrillic characters

Post by amarketzone » Mon Apr 28, 2008 1:52 pm

Hi Silanex,
I run your script but only I received it was "Make a backup of your MySQL database then remove this line" message and nothing happened to my database... where I am wrong? :(
The dream of my life: http://www.amz.ro

Silanex
Joomla! Intern
Joomla! Intern
Posts: 70
Joined: Mon Mar 13, 2006 3:12 pm

Re: Joomla Intern. Edition do not display Cyrillic characters

Post by Silanex » Mon Apr 28, 2008 3:57 pm

amarketzone wrote:Hi Silanex,
I run your script but only I received it was "Make a backup of your MySQL database then remove this line" message and nothing happened to my database... where I am wrong?
Hi,

that because you have not removed this line from code:

Code: Select all

die("Make a backup of your MySQL database then remove this line");

This line is left intentionally, that you could not run script, without first making a database backup..:)
Just to remind you to make a backup. So simply remove this line from code. Note, that you need also specify your data here:

$username = 'user';
$password = 'pass';
$database = 'table';
$host = 'localhost';

amarketzone
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Thu Apr 24, 2008 6:23 am
Location: Romania
Contact:

Re: Joomla Intern. Edition do not display Cyrillic characters

Post by amarketzone » Mon Apr 28, 2008 5:18 pm

Hello again,
Silanex, thank you very much for your very quick answer. I did'it, and it seems that it works... but...
it works, I think, only partially.... I dont't know, I'm desperate :( ... in all the tables it seems, endeed that collation was changed, but (hmmmm, i don't know how to put a print screen here... ) look here: The collation for general remain the same:

Row Statistics Statements Value
Format dynamic
Collation latin1_swedish_ci
Rows 3
Row length ø 20
Row size ø 1,044 B
Creation Apr 19, 2008 at 07:22 PM
Last update Apr 28, 2008 at 07:15 AM
Last check Apr 28, 2008 at 04:00 PM

Sorry for my bad english.
The dream of my life: http://www.amz.ro

Silanex
Joomla! Intern
Joomla! Intern
Posts: 70
Joined: Mon Mar 13, 2006 3:12 pm

Re: Joomla Intern. Edition do not display Cyrillic characters

Post by Silanex » Mon Apr 28, 2008 6:18 pm

Hi,

try run the following code against your MySQL database using Database Manager:

Code: Select all

ALTER DATABASE `db_name` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Replace 'db_name' with your mysql database name.
Open your Database Manager, select "SQL", this will open a text field, paste this query text into the box, click "Go".
Once it worked, it will bring you back to the same page and should confirm if all went well, something like "Your SQL-query has been executed successfully, etc


Locked

Return to “Language - 1.0.x”