problems with translited permalinks

Found a bug? Tell us!!
Post Reply
Dimonius
Regular
Posts: 14
Joined: Fri Jan 20, 2006 1:43 pm

problems with translited permalinks

Post 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 =(
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: problems with translited permalinks

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Dimonius
Regular
Posts: 14
Joined: Fri Jan 20, 2006 1:43 pm

Post 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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Dimonius
Regular
Posts: 14
Joined: Fri Jan 20, 2006 1:43 pm

Post by Dimonius »

ок. thanks for your answers!
I hope, that s9y team will fix this problem in new version! =)
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post 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?
Judebert
---
Website | Wishlist | PayPal
solomonk
Posts: 3
Joined: Mon Apr 17, 2006 9:52 am

Re: problems with translited permalinks

Post 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..
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: problems with translited permalinks

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Dimonius
Regular
Posts: 14
Joined: Fri Jan 20, 2006 1:43 pm

Post by Dimonius »

Oh, yeah! It works!
Thanks a lot!
=))
solomonk
Posts: 3
Joined: Mon Apr 17, 2006 9:52 am

Re: problems with translited permalinks

Post 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! :)
Post Reply