Posts Tagged ‘utf-8’

Using url_title() with Spanish or other strange characters

Posted in Snippets Ideas on March 14th, 2010 by admin – 3 Comments

If you are running your site in Spanish and using url_title to create Permalinks in CodeIgniter then likely you had run in character issues while creating your links.

Martin posted a solution in CodeIgniter’s forum with a workaround for this issue. He proposed


$trans = array(
                    $search                                => $replace,
                    "á"                                    => 'a',
                    "é"                                    => 'e',
                    "í"                                    => 'i',
                    "ó"                                    => 'o',
                    "ú"                                    => 'u',
                    "à"                                    => 'a',
                    "è"                                    => 'e',
                    "ì"                                    => 'i',
                    "ò"                                    => 'o',
                    "ù"                                    => 'u',
                    "ñ"                                    => 'n',
                    "ä"                                    => 'a',
                    "ë"                                    => 'e',
                    "ï"                                    => 'i',
                    "ö"                                    => 'o',
                    "ü"                                    => 'u',
                    "\s+"                                => $replace,
                    "[^a-z0-9".$replace."]"                => '',
                    $replace."+"                        => $replace,
                    $replace."$"                        => '',
                    "^".$replace                        => ''
                   );

My two cents here are the following. You can try to override the URL Helper by extending it in MY_url_helper.php under application/helpers directory.

Related searches:

  • codeigniter url_title
  • codeigniter url_title utf8
  • url_title codeigniter
  • codeigniter url_title javascript
  • url_title()
  • url_title javascript
  • url_title codeigniter utf-8
  • php utf8 url_title
  • codeigniter url_title() javascript
  • arabic url_title() codeigniter