Pagelist sortByName and special characters

Permalink
Hello!

I am adding a Pagelist block with code and are using

$pl->sortByName();


to sort the result alphabetically and it does so except for the special characters å, ä & ö. The å and ä appears in the top of the list and ö together with o. In most languages where they are used, they are listed at the end of the alphabet, after z.

Does anyone have an idea why this is and what I can do to make it appear according to the standards?

Thanks!

 
jordanlev replied on at Permalink Reply
jordanlev
I'd guess it is related to the collation setting in your MySQL database (either the database as a whole or the Pages table specifically). Try googling that and seeing if changing those settings helps. (Note that this is something general to MySQL, not specific to Concrete5, so there should be a ton of resources and reference material about it).
Remo replied on at Permalink Reply
Remo
Yes it is, but you might still have to modfiy concrete5 to get this working. By default, mysql uses DIN 5007-1 to sort strings in utf8 mode. In theory you should be able to use utf8_german2_ci instead, but As far as I know, it works if you're using MySQL 5.6, no guarantees though. MariaDB 5.5.5+ doesn't seem to have this problem.

Changing these things might be difficult, but there's another way. If you use a custom sort method, you can probably make your query look like this:

SELECT * FROM yout_table ORDER BY your_column COLLATE utf8_german2_ci;


something like this might work:
$pl = new PageList();
$pl->sortBy( 'cvName COLLATE latin1_german2_ci');


but again, just untested theory..