Sorting non-english characters in multilingual website I'm having an issue with finding good approach to make sorting works
  in a Drupal Views.
  
  I've multilingual website (1 database for all languages). Few
  languages are sorted wrong.
  
  I've read that the real issue is on database layer, however I can't set
  any specific encoding there, since database contains many different
  languages.
  
  What would be the most correct approach to make sorting works?
  The minimum I need atm is a sorting in a Drupal Views.


Any good approach of solving such issues?
It may help to somebody.

I end up with doing a simple module (which I'm gonna improve later) that inject COLLATE while doing query to Database so it sort everything properly.

Please feel free to comment this solution :)

&lt;?php

/**
 * @file
 * Implements hook_views_query_alter().
 *
 * it adds 'COLLATE utf8_language_ci' to languages that are not supported by default
 * so far there are only few languages we have issues with.
 */
function views_collate_sorting_views_query_alter(&amp;$view, &amp;$query) {
  // views where we want to enable collation
  $views = array(
    'dictionary_overview'
  );

  // exit if the current view is not specified
  if (!in_array ($view-&gt;name, $views)) {
    return FALSE;
  }

  // define list of languages we support
  $map = array(
    'da' =&gt; 'utf8_danish_ci',
    'sv' =&gt; 'utf8_swedish_ci',
    'nb' =&gt; 'utf8_danish_ci',
    'es' =&gt; 'utf8_spanish_ci',
    'pl' =&gt; 'utf8_polish_ci',
  );

  // get current utf8
  $l = $GLOBALS['language']-&gt;language;

  if (!array_key_exists ($l, $map)) {
    return FALSE;
  }

  // get current utf8 language which we are going to add to all sort fields
  $utf8 = $map[$l];

  // add COLLATE utf8_xx_ci to all sort criteria
  $orderby = &amp;$query-&gt;orderby;
  foreach ($orderby as &amp;$order) {
    $order['field'] .= ' COLLATE ' . $utf8;
  }
}