url_title and apostrophe - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: url_title and apostrophe (/showthread.php?tid=72076) |
url_title and apostrophe - imabot - 11-01-2018 I noticed that the url_title fonction does not convert apostrophes (single quotes) to dash (or underscore). French apostrophe is the same character as single quote. For example : "L'apostrophe" should be slugifyed as "l-apostrophe" Currently, single quotes are removed and not converted to separators (L'apostrophe → lapostrophe). I would like to update the url_title function, but I'm not familiar with regex. Could someone help me to update the function so that it converts single quotes into dash. PHP Code: // url_helper.php - line 493 RE: url_title and apostrophe - jreklund - 11-02-2018 URL Helper ain't an expert on foreign characters, but convert_accented_characters() are. url_title(convert_accented_characters('L'apostrophe')); https://www.codeigniter.com/user_guide/helpers/text_helper.html#convert_accented_characters Can't seem to find it, so you need to add it in your application/config/foreign_chars.php '/L\'/' => 'L-', RE: url_title and apostrophe - imabot - 11-02-2018 (11-02-2018, 12:10 AM)jreklund Wrote: URL Helper ain't an expert on foreign characters, but convert_accented_characters() are. That's interesting. The problem is that, in French, apostrophe can be associated to many characters, for example :
PHP Code: '/\'/' => ' ', RE: url_title and apostrophe - jreklund - 11-02-2018 No, not really. I would make a function like this: PHP Code: function french_url_title($str,$seperator='-',$lowercase=FALSE) { |