Community Forums

ATutor Bug Reports

Sorting of last names in russian

Page: 1

Avatar for NickSlavsky
Subject: Sorting of last names in russianQuote this post in your reply
my system specs can be found in this thread

i am having really hard times getting the system to work for russian language and found yet another bug/peculiarity:

when i click onto the column name Фамилия which corresponds to the last name - the data gets obviously sorted, but not in a utf-8 order. The fact that they ARE sorted is proved by the grouping: the last names are grouped by the first letters. however, the list starts with letter Л which is somewhere in the middle of the alphabet.

I carried out some tests and here is what i found: the database collation is utf 8 so it is not an issue of how the data is STORED in database. I think that it deals with the way how the data is TRANSMITTED to the front end.

Can you help me if this is a bug or i can fix it by changing some settings on my side?

i feel that the two threads i submitted are somehow linked...

If you need it, i can help you with the testing, since russian is my native language.
Posted: 2010-02-26 07:43:37

Avatar for harris
Subject: Re: Sorting of last names in russianQuote this post in your reply

This might be a problem related to this thread:

If you can help me to test it a bit, setup a new database, then open


change line 16:
$db = @mysql_connect(DB_HOST . ':' . DB_PORT, DB_USER, DB_PASSWORD);

$db = @mysql_connect(DB_HOST . ':' . DB_PORT, DB_USER, DB_PASSWORD);
mysql_query("SET NAMES 'utf8'", $db);

Also, make sure your mysql server are in utf-8 , otherwise do the following:
mysql_query("SET collation_connection = 'UTF-8_general_ci'");
mysql_query("SET collation_server = 'UTF-8_general_ci'");
mysql_query("SET character_set_client = 'UTF-8'");
mysql_query("SET character_set_connection = 'UTF-8'");
mysql_query("SET character_set_results = 'UTF-8'");
mysql_query("SET character_set_server = 'UTF-8'");

Then, try adding data into your database and sort it again. Can you let me know if they are sorted correctly according to the UTF8 order now?
Posted: 2010-02-26 09:52:09

Avatar for harris
Subject: Re: Sorting of last names in russianQuote this post in your reply

You can do a quick check on your shell,

mysql> show variables like 'c%';

does it say latin1 or UTF8 for the collation and connection?
Posted: 2010-02-26 15:04:30

Avatar for NickSlavsky
Subject: Re: Sorting of last names in russianQuote this post in your reply
thanks so much!
indeed the output of the query
mysql> show variables like 'c%';
showed that
character_set_results and collation_server were cp1251

i added the set names query as you proposed and the new data i add is always sorted properly and even the issue from the thread
went away.

So two questions arise:

1. are you going to include the set names query in the version 1.6.5? otherwise yoiu need to post these instructions in the getting started section of the handbook

2. Is there any way i can change the data i have entered prior to this moment? after i issued the set names query all previous utf-8 entries are displayed as gibberish because they were utf-8 encoded into cp1251. now i have to go through like 20 users and 15 courses and change names. is there any way i can automate this?
Posted: 2010-02-27 04:01:53

Avatar for harris
Subject: Re: Sorting of last names in russianQuote this post in your reply

1. I have already added this to our bug tracker ( For sure it will be in one of the upcoming ATutor versions. We will try to make it into 1.6.5 but there are several things that needed to be done before adding this in (ie. creating a script that will convert the database). If we run out of time and can't make this into the 1.6.5, it will be in the 1.6.6 or later versions. However, we will try our best to make it into the closest release.

2. Currently, there are 2 ways of fixing this. One is to do the following:

simple fix (needs shell/admin access), backup your database first.

This following will export all the data using latin1 connection.
> mysqldump -u root -p <atutor_db_name> --default-character-set="cp1251" > atutor.sql

Open atutor.sql, replace
/*!40101 SET NAMES cp1251 */; to
/*!40101 SET NAMES utf8 */;
(and potentially all cp1251 to utf8)

Then, import the database back in using UTF8 connection.
> mysql -u root -p <atutor_db_name> --default-character-set="utf8" < atutor.sql

This should change your existing data in your atutor database from cp1251 to utf8.

Second way is to run the script by Tasmi, which he posted here,

In the future release, there will be a script that will automate this process during the upgrade step.

Hope this helps.

Posted: 2010-03-01 09:59:38
Page: 1

You must be signed-in to post.

Related Articles