We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10189
    • 109 Posts
    Being swedish, some of the projects I will be working on will inevitably contain page titles that has swedish characters in them (i.e. "a" and "o" with umlauts and whatnot, that is "å", "ä" and "ö"). Right now, MODx rewrites the aliases in a way I don’t like. "ä" becomes "ae" and "ö" becomes "oe".

    Can anyone help me change this so that the resulting alias contains just plain "a" and "o" instead?

    example:
    http://www.example.se/oevrigt/

    will instead be transformed to

    http://www.example.se/ovrigt/

    Thanks smiley
      • 10189
      • 109 Posts
      Nevermind! I found the function responsible for the special characters replacement. smiley

      For those of you wondering, the function resides in save_content.processor.php around line 570.

      function stripAlias($alias) {
      	global $modx;
      
      	if (strtoupper($modx->config['modx_charset']) == 'UTF-8')
      		$alias = utf8_decode($alias);
      	$alias = strtr($alias, array (
      		chr(196) => 'Ae', chr(214) => 'Oe', chr(220) => 'Ue', chr(228) => 'ae', chr(246) => 'oe', chr(252) => 'ue', chr(223) => 'ss'));
      
      	$alias = strip_tags($alias);
      	//$alias = strtolower($alias); 
      	$alias = preg_replace('/&.+?;/', '', $alias); // kill entities 
      	$alias = preg_replace('/[^\.%A-Za-z0-9 _-]/', '', $alias);
      	$alias = preg_replace('/\s+/', '-', $alias);
      	$alias = preg_replace('|-+|', '-', $alias);
      	$alias = trim($alias, '-');
      	return $alias;
      }