ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Change collation for proper sorting

April 27, 2012 8:35am

Subscribe [1]
  • #1 / Apr 27, 2012 8:35am

    o_cee

    16 posts

    Hello

    Trying to get titles from my entries sorted correctly in Swedish, so I’d need to change the MySQL collation to utf8_swedish_ci.

    The following works fine:

    select title from exp_channel_titles where channel_id = 5 order by title  collate utf8_swedish_ci

    However, utf8_general_ci (EE default) or utf8_unicode_ci (what otherwise is considered the collation you should use http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci) doesn’t return the expected order according to Swedish rules.


    The question is; what is the supported, most correct way of doing this? Should the whole database be changed? Only the exp_channel_titles? Only exp_channel_titles.title?

    Does database.php need to be changed?

    Thanks

  • #2 / Apr 30, 2012 11:11am

    Dan Decker

    7338 posts

    Hi o_cee,

    I had to go talk to the developers to make sure, but you can change the collation for the entire ExpressionEngine database without any worries. Future updates to EE won’t change it back and you can get the ordering you need.

    Is there anything else I can assist you with?

    Cheers,

  • #3 / Apr 30, 2012 12:39pm

    o_cee

    16 posts

    Nope, thanks for the clarification, you can close this thread.

  • #4 / Apr 30, 2012 5:39pm

    Dan Decker

    7338 posts

    Hi o_cee,

    Awesome!

    If you have questions in the future, just open a new thread!

    Cheers!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases