1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to change friendly urls letters?

Discussion in 'General Troubleshooting' started by ganbatte, Apr 12, 2010.

  1. ganbatte

    ganbatte New Member

    hi all.

    i wanted use Hotaru CMS. but i gave a problem with friendly urls with turkish characters.

    for example :
    Title: Acun'un meleği konuştu - Hürriyet
    URL: http://www.domain.com/scxzsd/acunun-meleayi-konuaytu-hirriyet/

    I wanna change some letters. for example ğ to g, ü to u, ş to s.

    greetings from Turkey.
     
  2. Nick

    Nick Well-Known Member

    Hmmm...... maybe in /functions/funcs.strings.php from line 195 in the replace_symbols() function.

    E.g.

    PHP:
    $output str_replace("ğ""g"$output);
    That would only get applied to new urls, and every time you upgrade Hotaru, you'll need to add your changes back in.

    P.S. Greetings from Japan! ;)
     
  3. ganbatte

    ganbatte New Member

    Thank you but it doesn't work :( I need that seriously.

    P.S. I am from Turkey but my girl friend is Japanese we met in South Africa! ;) I love Japanese people.
     
  4. Nick

    Nick Well-Known Member

    In that case, I'm afraid I don't know. We use the same functions as Wordpress, such as remove_accents() on line 301 of the /functions/funcs.strings.php. Maybe you need to add the appropriate chr items to (line 409~):

    PHP:
    } else {
            
    // Assume ISO-8859-1 if not UTF-8
            
    $chars['in'] = chr(128).chr(131).chr(138).chr(142).chr(154).chr(158)
                .
    chr(159).chr(162).chr(165).chr(181).chr(192).chr(193).chr(194)
                .
    chr(195).chr(196).chr(197).chr(199).chr(200).chr(201).chr(202)
                .
    chr(203).chr(204).chr(205).chr(206).chr(207).chr(209).chr(210)
                .
    chr(211).chr(212).chr(213).chr(214).chr(216).chr(217).chr(218)
                .
    chr(219).chr(220).chr(221).chr(224).chr(225).chr(226).chr(227)
                .
    chr(228).chr(229).chr(231).chr(232).chr(233).chr(234).chr(235)
                .
    chr(236).chr(237).chr(238).chr(239).chr(241).chr(242).chr(243)
                .
    chr(244).chr(245).chr(246).chr(248).chr(249).chr(250).chr(251)
                .
    chr(252).chr(253).chr(255);

            
    $chars['out'] = "EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy";
    P.S My wife's Japanese. I love Japanese people, too! (except my mother-in-law ;) )
     
    anika039 likes this.
  5. ganbatte

    ganbatte New Member

    The codes already added to there? What can i do? :(

    PHP:
    } else {
            
    // Assume ISO-8859-1 if not UTF-8
            
    $chars['in'] = chr(128).chr(131).chr(138).chr(142).chr(154).chr(158)
                .
    chr(159).chr(162).chr(165).chr(181).chr(192).chr(193).chr(194)
                .
    chr(195).chr(196).chr(197).chr(199).chr(200).chr(201).chr(202)
                .
    chr(203).chr(204).chr(205).chr(206).chr(207).chr(209).chr(210)
                .
    chr(211).chr(212).chr(213).chr(214).chr(216).chr(217).chr(218)
                .
    chr(219).chr(220).chr(221).chr(224).chr(225).chr(226).chr(227)
                .
    chr(228).chr(229).chr(231).chr(232).chr(233).chr(234).chr(235)
                .
    chr(236).chr(237).chr(238).chr(239).chr(241).chr(242).chr(243)
                .
    chr(244).chr(245).chr(246).chr(248).chr(249).chr(250).chr(251)
                .
    chr(252).chr(253).chr(255);

            
    $chars['out'] = "EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy"
     
  6. Nick

    Nick Well-Known Member

    Can you give us an example link?
     
  7. ganbatte

    ganbatte New Member

  8. Nick

    Nick Well-Known Member

    In both examples you gave, there is no problem with the url. You asked to change ğ to g, ü to u, ş to s, etc, but it already is making those changes.

    The problem you are having is with Turkish characters in the title, not the url.

    Try this:

    1. Open /plugins/submit/libs/SubmitFunctions.php
    2. Find the fetchTitle() function from line 696
    3. Remove:

    PHP:
    if (preg_match('/charset=([a-zA-Z0-9-_]+)/i'$string $matches)) {
                
    $encoding=trim($matches[1]);

                
    //you need iconv to encode to utf-8 (if not, use custom iconv in funcs.strings.php)
                
    if (strcasecmp($encoding'utf-8') != 0) {
                    
    //convert the html code into utf-8 whatever encoding it is using
                    
    $string=iconv($encoding'UTF-8//IGNORE'$string);
                }
            }
    4. Change:

    PHP:
    return $title;
    to

    PHP:
    return remove_accents($title);
    I'm guessing, but you might get lucky!
     
  9. ganbatte

    ganbatte New Member

    Thank you so much for help, it worked but i don't want to change turkish characters in title :)

    I wanna something like that.

    Title: ğüşçıö
    URL: http://www.a.com/guscio

    I want use turkish characters in title. But in url it must change. Is that possible?

    The code you gave me, changing the title. :(

    Ganbatte Yasin!!! (it is my name :) )
     
  10. ganbatte

    ganbatte New Member

    There is no way to fix? :(
     
  11. Nick

    Nick Well-Known Member

    1. Open /functions/funcs.strings.php
    2. Change line 175 from
    PHP:
    $output mb_strtolower($output);
    to:
    PHP:
    $output mb_strtolower($output"UTF-8");
    This fix will be included in the next version of Hotaru.
     
  12. ganbatte

    ganbatte New Member

    Sorry doesn't working :(

    After "submit url"

    this error. I wanted use Hotaru CMS. But looks like I cannot due to Turkish characters :/
     
  13. Nick

    Nick Well-Known Member

    Really? I was up until 2am last night trying to fix the Turkish url problem for you, and I'm pretty sure it does work:

    turkish_chars.png

    If you need any more help, please read this first.
     
  14. ganbatte

    ganbatte New Member

    WOW! Looks great. But it didn't work. I will try again. I hope this time can work.

    Also I am sorry my English very bad.

    Thank you.
     
  15. anika039

    anika039 New Member

    I got the same problem in Bangle. I'll think about it later.
     

Share This Page