Codeigniter Uri segments are not printing special characters correctly

592 Views Asked by At

I have url http://localhost/my_project/welcome/special_chars/äöü Now I am trying to print last segment using echo utf8_decode($this->uri->segment(3)); I am not getting the original value but when I write print like echo utf8_decode('äöü'); then I am getting proper value.

1

There are 1 best solutions below

1
Ramesh Mhetre On

I think its something to do with permitted_uri_characters setting in the config. You need to add your special character in the config like

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_()@&\-!';

For more info please refer this link: How do you allow URI encoded characters in CodeIgniter URLs?