GetSimple Support Forum
Slugs in servers with no mb_* functions - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Developer Discussions (http://get-simple.info/forums/forumdisplay.php?fid=8)
+--- Thread: Slugs in servers with no mb_* functions (/showthread.php?tid=4053)



Slugs in servers with no mb_* functions - Carlos - 2012-12-23

It seems GS has trouble creating slugs if your server does not have the multibyte extension (mb_* functions) and you use non US-ASCII latin characters (á, è, ...) in your page titles.

Suggested patch:

Edit /admin/inc/basic.php, find this (around line 62):
PHP Code:
function to7bit($text,$from_enc="UTF-8") {
        if (
function_exists('mb_convert_encoding')) {
           
$text mb_convert_encoding($text,'HTML-ENTITIES',$from_enc);
       } 

Just after that, in line 66, insert this:

PHP Code:
    else 
        
$text htmlspecialchars_decode(utf8_decode(htmlentities($textENT_COMPAT'utf-8'false))); 

...just before this:

PHP Code:
$text preg_replace

Now you should be able to use a title like Déjà vu, and the page slug will be deja-vu (and saved as deja-vu.xml, not as d%C3%A9j%C3%A0-vu.xml).

(Ref: http://stackoverflow.com/questions/11974008/alternative-to-mb-convert-encoding-with-html-entities-charset )

Thoughts?


RE: Slugs in servers with no mb_* functions - shawn_a - 2012-12-24

nice fallback
Why would someone not have multibyte at this point though ?


RE: Slugs in servers with no mb_* functions - Carlos - 2012-12-24

No idea why, maybe for (excessive) security reasons?


RE: Slugs in servers with no mb_* functions - Carlos - 2012-12-24

GitHub issue #464


RE: Slugs in servers with no mb_* functions - D.O. - 2012-12-25

I can tell it works great!


RE: Slugs in servers with no mb_* functions - Carlos - 2012-12-25

Already done in svn, so it will be fixed for next GS 3.2.0 release.


RE: Slugs in servers with no mb_* functions - D.O. - 2012-12-26

great!


(2012-12-25, 22:03:25)Carlos Wrote: Already done in svn, so it will be fixed for next GS 3.2.0 release.



RE: Slugs in servers with no mb_* functions - shawn_a - 2012-12-26

3.3.0
3.2 is already in beta testing, only hotfixes at this point.


RE: Slugs in servers with no mb_* functions - Carlos - 2012-12-26

Oops!