Forums

Permalinks and non-english letters (6 posts)

  1. ahh
    Member
    Posted 2 years ago #

    Hi when creating a new post on wordpress, and using non-english leters in the title will result in some bad permalinks.

    Lets say the title is "å - æ - ø - å - a"
    The permalink is then generated by wordpress to "....../a-æ-ø-a-a/"

    Why is only the 'å' letter beeing "correctly" transoformed to 'a' ?

    Is there a way to make

    å => aa
    ø => oe
    æ => ae

    witch is the correct non-æøå keyboard writing.

  2. Shane G.
    Member
    Posted 2 years ago #

    Hi,

    http://codex.wordpress.org/Using_Permalinks

    You can set your desired permalink from wordpress admin area and add this code in htaccess:

    # BEGIN WordPress
    
    <IfModule mod_rewrite.c>
    ErrorDocument 404 /index.php?error=404
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    Now, have a check with old and new posts for all the pages and posts.

    Thanks,

    Shane G.

  3. ahh
    Member
    Posted 2 years ago #

    Thanks, but permalinks are working..

    The problem is that worpress sugest I use 'æ' and 'ø' in the links, but it alters all 'å's to 'a's .....

  4. schjetne
    Member
    Posted 1 year ago #

    I've googled and googled and googled and there is STILL no solution to this problem? The guy I'm building a site for is pretty desperate about this. He says it's a useless site if he has to make sure there are no æ's and ø's in the permalink for every post and page. His users are unfortunately emailing ME about 404 errors.

    Does ANYONE know when there'll be a fix to this?

  5. schjetne
    Member
    Posted 1 year ago #

    $translate_language = array(
    	'da' => array(
    		'NOMO' => 'Dansk, Norsk',
    		'da_aeoeaa' => 'æ, ø, å &rarr; ae, oe, aa'
    	)
    );
    
    $translate_system = array();
    
    function sanitize_title_dk($title)
    {
    	global $translate_language, $translate_system;
    	if (!mb_check_encoding($title, 'ASCII'))
        {
          $title=utf8_decode($title);
          foreach (array_keys($translate_language) as $language)
            {
    		  $choise = 'da';
              switch ($choise)
              {
                case 'da':
        		$translate_system[] = array
                (
        		  "Æ"=>"ae","Ø"=>"oe","Å"=>"aa","æ"=>"ae","ø"=>"oe","å"=>"aa"
        		);
              }
    		}
    	  foreach ($translate_system as $system)
          {
    	  	$title = strtr($title, $system);
    	  }
    	}
    	return $title;
    };
    add_filter('sanitize_title', 'sanitize_title_dk', 0);

    Found this somewhere, drop it in your functions.php and problem solved. Easy.

  6. zaibotdk
    Member
    Posted 1 year ago #

    Where should i paste it in my wp-includes/functions.php file?
    I tried pasting it in the bottom, but that didn't work at all.

Topic Closed

This topic has been closed to new replies.

About this Topic