CodeIgniter Forums
How to use non-latin characters in slug? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forum-9.html)
+--- Thread: How to use non-latin characters in slug? (/thread-71067.html)



How to use non-latin characters in slug? - Serializable - 07-01-2018

The posts table contains a record where slug field is: пролпрол-про-апрарр

I try to get the post using controller:

Quote:public function view($slug = NULL){


    $data['post'] = $this->post_model->get_posts($slug);

    if(empty($data['post'])){
        show_404();
    }
    ...

A link to view this post in browser


Quote:http://localhost/ciblog/posts/пролпрол-про-апрарр

but note, when I copied it to paste it here it is:


Quote:http://localhost/ciblog/posts/%D0%BF%D1%80%D0%BE%D0%BB%D0%BF%D1%80%D0%BE%D0%BB-%D0%BF%D1%80%D0%BE-%D0%B0%D0%BF%D1%80%D0%B0%D1%80%D1%80

For some reason in browser I get


Quote:404 Page Not Found


How can I fix that to use a non-latin slug?

I have changed permitted_uri_chars to be

Code:
[size=small][i]a-z 0-9~%.:_-абвгдеёжзийклмнопрстуфхцчшщъыьэюя[/i][/size]

but it seems nothing changed.


RE: How to use non-latin characters in slug? - InsiteFX - 07-03-2018

See: PHP.NET urlencode and url decode.


RE: How to use non-latin characters in slug? - Serializable - 07-03-2018

(07-03-2018, 04:42 AM)InsiteFX Wrote: See: PHP.NET urlencode and url decode.

I used a slightly diiferent solution by transliterating incoming slug. This way database records looks more consciously istead of something   incomprehensible like %D1%82%D0%B5%D0%BA%D1%81%D1%82