Welcome Guest, Not a member yet? Register   Sign In
url_title in url helper doesn't work for Bangla
#1

Hello,

I have been developing in Codeigniter for over a month now, I just came up with this new problem in codeigniter for the first time, which is:
the url_title() function of the url helper return an empty string for a bangla string or bangla letters. I have googled a lot, and what I understood is that Bangla letter's pattern should be added into the url_title core function, so that bangla characters can be replaced rather then being empty. But after googling a lot, I couldn't find the pattern for bangla characters, can someone please help me on this, I know this is very simple, maybe I am searching with some wrong keywords or something, I just want a straight solution to this as I have wasted almost two days googling.

Thanks in advance.
Reply
#2

Perhaps, you have to search PHP code for transliteration of Bangla characters to ASCII (English). If such routine exists, install it and use it on Bangla texts before you pass them to url_title().
Reply
#3

(11-11-2015, 10:14 AM)ivantcholakov Wrote: Perhaps, you have to search PHP code for transliteration of Bangla characters to ASCII (English). If such routine exists, install it and use it on Bangla texts before you pass them to url_title().

So, the concept/logic is first I translate my bangla letters into ASCII then pass them to url_title()??
Tarek Showkot
Independent Developer
http://facebook.com/f0rg0tt3n
Reply
#4

The iconv transliteration feature does not work for Bangla, at least in my computer. I installed the intl PHP extension (http://php.net/manual/en/book.intl.php) and tried it:

Code:
$string = 'Sample text: বাংলা';

$transliterator = Transliterator::create('Bengali-Latin');
$string = $transliterator->transliterate($string);

$string = url_title($string, '-', true);

var_dump($string);

The result is "sample-text-banla"
Reply
#5

After some digging I think this is a better version:

Code:
$string = 'Sample text: বাংলা';

$transliterator = Transliterator::create('Bengali-Latin; Any-Latin; Latin-ASCII');
$string = $transliterator->transliterate($string);

$string = url_title($string, '-', true);

var_dump($string);
Reply
#6

(11-11-2015, 10:44 AM)forgotten Wrote:
(11-11-2015, 10:14 AM)ivantcholakov Wrote: Perhaps, you have to search PHP code for transliteration of Bangla characters to ASCII (English). If such routine exists, install it and use it on Bangla texts before you pass them to url_title().

So, the concept/logic is first I translate my bangla letters into ASCII then pass them to url_title()??

Yes. Otherwise the link with Bangla letters might (or might not?) work in your site, but when such a link of yours is published in other systems it might not pass validations or it could be damaged.

I've just saw your question, sorry.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB