Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter URL_TITLE UTF8 Characters?

I have problem with codeigniter something like this i have string this like

$string="Mučnina – problem u vožnji!";

When i do something like this

$url_title = url_title($string, '_', TRUE);

I got this

$string="munina_problem_u_vonji";

Big difference?

How to modified url_title parameters?

like image 935
Miomir Dancevic Avatar asked Mar 23 '23 14:03

Miomir Dancevic


1 Answers

This is what i done :

1. go to application/config/foreign_chars.php

2. added

'/š/' => 's', 
'/đ/' => 'd', 
'/č/' => 'c', 
'/ć/' => 'c', 
'/ž/' => 'z', 
'/Š/' => 'S', 
'/Đ/' => 'D', 
'/Č/' => 'C', 
'/Ć/' => 'C', 
'/Ž/' => 'Z', 

3. Just call

$clean=convert_accented_characters($string);
 $url_title = url_title($clean, '_', TRUE);
like image 69
Miomir Dancevic Avatar answered Apr 05 '23 18:04

Miomir Dancevic