Summary: | Case-insensitive search in collection browser broken | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | Alexander Klyubin <A.Kljubin> |
Component: | general | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Alexander Klyubin
2005-04-26 21:15:33 UTC
Amarok stores data in the database in UTF-8 encoding. It turned out that MySQL did not support UTF-8 encoding before version 4.1. Thus, case-insensitive comparison operations (LIKE in this case) could not work properly with non latin1 characters. I've upgraded MySQL to 4.1.8 and configured it to use UTF-8 by default on the server side. Then, I modified amarok's code to tell MySQL that Amarok also uses UTF-8 encoding. Finally, I let Amarok create a new database. Everything works fine now. Collection browser does proper case-insensitive filtering for latin characters and for cyrillic characters. The only problem is that this fix works only for MySQL case and only if one uses MySQL 4.1+. --- There are two ways to make MySQL use UTF-8 on the server side: 1. Add two lines in /etc/mysql/my.cnf under [mysqld] section: character-set-server = utf8 collation-server = utf8_general_ci OR 2. Tell that Amarok's database uses UTF-8 explicitly, passing CHARACTER SET and COLLATE arguments to CREATE DATABASE or ALTER DATABASE. --- To tell MySQL that Amarok uses UTF-8 I added following code in MySqlConnection::MySqlConnection after mysql_init and before mysql_real_connect: if ( mysql_options( m_db, MYSQL_SET_CHARSET_NAME, QString("utf8").latin1() ) ) { error() << "Failed to set charset to utf8\n"; } Collection Browser items are now properly sorted. I notice the same bug with amarok 1.3.4 and sqlite 3.2.7 as backend. |