Allow special character in CodeIgniter

Discussion for various published PHP frameworks, including Zend Framework, CodeIgniter, Kohana, CakePHP, Yii, Symfony, and others.

Moderator: General Moderators

Post Reply
ayu
Forum Newbie
Posts: 2
Joined: Mon Mar 05, 2012 5:38 am

Allow special character in CodeIgniter

Post by ayu »

Hello all,

I have problem, and not yet finished.
If i use preg_replace with PHP(no framwork CI). Its work.
but in CodeIgniter, its didn't work, I've search and do some result as: Make general UTF-8, $config['permitted_uri_chars'].
But nothing result.

Example:

Code: Select all


$text='name';
var_dump(preg_replace('/e/', 'é', $text));

and the result is
nam�
character freak with question mark.


Anyone can help how to allow write special character and the result is [text]namé[/text] ?
Thank you.
User avatar
greyhoundcode
Forum Regular
Posts: 613
Joined: Mon Feb 11, 2008 4:22 am

Re: Allow special character in CodeIgniter

Post by greyhoundcode »

[syntax]# Unicode in regular expressions
\x{00C9}[/syntax]

I'm assuming that what you actually want to do here is allow special characters in your site URLs. If so you may want to read up on Internationalized Resource Identifiers first of all as I don't think your current approach will work. Instead - as I understand it - accented and other special characters are transliterated into regular ASCII.
rst
Forum Newbie
Posts: 1
Joined: Wed Apr 11, 2012 1:27 am

Re: Allow special character in CodeIgniter

Post by rst »

you can use:

Code: Select all

$text="name";
var_dump(preg_replace("/e/", "é", $text)); 




search jobs find jobs http://www.jobnak.com
Post Reply