Page 1 of 1

problems with translited permalinks

Posted: Fri Mar 24, 2006 5:44 pm
by Dimonius
I write my blog in russian (Cyrillic), so the name of the post as usial not have latin letters. And permalinks in version 0.9 was generated in translit - thats grate!
When I has upgraded to 1.0 beta 2, all my permalinks is desappeared, now they look like "blog/archives/376-unknown.html" or "blog/archives/372-_8_!.html" (only spaces, digits and latin simbols)
Same problems with categories names in russian.
where is the bug? i`m in panik =(

Re: problems with translited permalinks

Posted: Sun Mar 26, 2006 9:50 pm
by garvinhicking
Did you change anything in your SQL database maybe?

And when you try to use normal lating characters a-z, do the permalinks then work again? Do permalinks only stop to work for old entries, or for new entries as well?

Regards,
Garvin

Posted: Mon Mar 27, 2006 4:05 pm
by Dimonius
No, i change nothing in sql database. And at first, when i look on table "permalinks", there was right names, but they don`t work on the site. I try to fix that problem with turning off/on the mode_rewrite option in admin panel (this method helped me with the same problem in beta 1 version), so table permalinks was rewrited with wrong names.

Yes, permalinks work right with latin characters and numerals, and all, old and new posts generates with bad permalinks.

Posted: Mon Mar 27, 2006 7:07 pm
by garvinhicking
I think that recent 1.0 versions contained a change to use htmlspecialchars() or so for permalinks, because non-latin cahracters are not allowed in URLs.

Sadly I'm ill right now so I can't thorougly investigate it; but I'm afraid the change might be intentional because of problems with other languages like chinese where those characters might not show up in a URL conform to RFC

Regards,
Garvin

Posted: Tue Mar 28, 2006 2:23 pm
by Dimonius
ок. thanks for your answers!
I hope, that s9y team will fix this problem in new version! =)

Posted: Tue Mar 28, 2006 5:09 pm
by judebert
Seems to me we could add a bit to the language files. PHP supports a strtr() function that can do either characters or strings. If we do characters, we'll need two variables: a "from" string and a "to" string. If we do strings, we'll need an array with strings: 'ä' => 'a', 'ä' => 'a', etc.

Anything not handled in the translation could be removed by the existing code.

Whatcha think, Garvin?

Re: problems with translited permalinks

Posted: Mon Apr 17, 2006 10:06 am
by solomonk
Dimonius wrote:I write my blog in russian (Cyrillic), so the name of the post as usial not have latin letters. And permalinks in version 0.9 was generated in translit - thats grate!
When I has upgraded to 1.0 beta 2, all my permalinks is desappeared, now they look like "blog/archives/376-unknown.html" or "blog/archives/372-_8_!.html" (only spaces, digits and latin simbols)
Same problems with categories names in russian.
where is the bug? i`m in panik =(
hi! i'm also using 1.0-beta2 and have such problem..

please have a look at /serendipity/include/functions_permalinks.inc.php

there are two portions of code:
1) doing utf8_decode

Code: Select all

    
if (LANG_CHARSET == 'UTF-8') {
      // URLs need to be 7bit - since this function takes care of the most common ISO-8859-1
        // characters, try to UTF8-decode the string first.
        $str = utf8_decode($str);
    }
2) doing str_replace with settings from ru landuage file

Code: Select all

    if (isset($GLOBALS['i18n_filename_from'])) {
        // Replace international chars not detected by every locale.
        // The array of chars is defined in the language file.
        $str = str_replace($GLOBALS['i18n_filename_from'], $GLOBALS['i18n_filename_to'], $str);
    } else {
        // Replace international chars not detected by every locale
        $str = str_replace($from, $to, $str);
    }
Interchange this two portions of code.. so, before entity name passed throw utf8_decode all cyrillic symbols will be correctly replaced by str_replace..

i don't know is it a bug or not..

Re: problems with translited permalinks

Posted: Mon Apr 17, 2006 11:50 am
by garvinhicking
Hi!

Thanks, this actually has been fixed in 1.0 SVN and the 1.1 versions, so it'll be contained in the 1.0 final release. :)

Best regards,
Garvin

Posted: Mon Apr 17, 2006 12:17 pm
by Dimonius
Oh, yeah! It works!
Thanks a lot!
=))

Re: problems with translited permalinks

Posted: Mon Apr 17, 2006 12:53 pm
by solomonk
garvinhicking wrote:Hi!
Thanks, this actually has been fixed in 1.0 SVN and the 1.1 versions, so it'll be contained in the 1.0 final release. :)
great! i'm waiting for 1.0 final release impatiently..

off: s9y is the best, thanks for it! :)