Community Forums

ATutor Bug Reports

Sorting of last names in russian


You must be signed-in to post.

AuthorSubject
 
Page: 1
NickSlavsky

Avatar for NickSlavsky
Screen.doc
Subject: Sorting of last names in russianQuote this post in your reply
hello!
my system specs can be found in this thread
www.atutor.ca/view/3/19602/1.html

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
harris

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

This might be a problem related to this thread: www.atutor.ca/view/12/19399/1.html

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

include/lib/mysql_connect.inc.php

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

to
$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
harris

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

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
NickSlavsky

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
www.atutor.ca/view/3/19602/1.html
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
harris

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

1. I have already added this to our bug tracker (http://www.atutor.ca/atutor/mantis/view.php?id=4107). 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, www.atutor.ca/view/12/19399/1.html.

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

Hope this helps.


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

You must be signed-in to post.

Related Articles