WordPress.org

Ready to get started?Download WordPress

Forums

Table: wp_posts, column post_name not unicode. (3 posts)

  1. maxemil
    Member
    Posted 4 years ago #

    Hey chaps,
    Im experiencing a bug I believe.

    Im using Danish letters æøå ÆØÅ.

    While entrys to the database table "wp_posts" column "post_title" and "post_content" are being written correctly with æøå, the column "post_name" are not.. eg:

    post_title: "Vedtægter"
    post_name: "vedt%c3%a6gter"

    This is a problem when I use wp_list_pages() and the permalink is the taking the "post_name" for href, this results in pages not found.

    A snippet of settings:

    wp-config.php
      define('DB_CHARSET', 'utf8');
      define('DB_COLLATE', '');
      define ('WPLANG', 'da_DK');

    Im running XAMPP on Vista 64 bit, and this is my development pc. I do however not consider it to be an OS or Apache issue.

    what to do, anyone with similar issues?

  2. maxemil
    Member
    Posted 4 years ago #

    Im digging around, finding others with similar problem.
    Aparently post_name is also called SLUG...

    http://wordpress.org/support/topic/274134

    And *sigh* I realise its sanitize_title() that makes a laugh at our language.

    what to do.. what to do...

  3. maxemil
    Member
    Posted 4 years ago #

    btw.. I dumped a code snippet from a plugin called "transliterado" into my functions.php ... this dosent give me æøå letters, but atleast I dont get 404

    // ----   SLUG Permalink æøå   --- //
    $translate_language = array(
    	'da' => array(
    		'NOMO' => 'Dansk, Norsk',
    		'da_aeoeaa' => 'æ, ø, å → 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);
    // ----   SLUG Permalink æøå   END //

Topic Closed

This topic has been closed to new replies.

About this Topic