Welcome Guest, Not a member yet? Register   Sign In
Allow special character in CodeIgniter [confused]
#1

[eluser]Ayu[/eluser]
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:
$text='name';
var_dump(preg_replace('/e/', 'é', $text));

and the result is
Quote:nam�

character freak with question mark.


Anyone can help how to allow write special character and the result is

Quote:namé

Thank you very much
#2

[eluser]Aken[/eluser]
Make sure your HTML output is also set to UTF-8 with a meta tag.

Also, preg_replace() is pretty inefficient for replacing a single character. Just use str_replace for that.
#3

[eluser]Ayu[/eluser]
I've use UTF-8
Code:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta charset="utf-8">

same case.
i use
Code:
echo 'namé';

and the result's
Quote:nam�

Please, help me to solve this problem.
#4

[eluser]cPage[/eluser]
It's probably a question of browser encoding.

Try to be explicit with the browser with :

Code:
header('Content-Type: text/html; charset=utf-8');

in the top of your view before any php.
#5

[eluser]Ayu[/eluser]
i've write it before but the same result.

<?
header('Content-Type: text/html; charset=utf-8');
?>

help me please...




Theme © iAndrew 2016 - Forum software by © MyBB