About special characters remplacement

phpBB3 SEO Advanced mod Rewrite support forum.
This mods performs URL rewriting for phpBB, injecting forums and topic titles in their URLs.

Moderator: Moderators

Postby hroudel » Tue Dec 16, 2008 1:48 pm

This should be complete special chars rewrite for czech language.
Supported and tested chars are:
Code: Select all
ěščřžýáíéúůóďťňĚŠČŘŽÝÁÍÉÚŮÓĎŤŇ

Some chars are supported by phpBB SEO in general.
Code: Select all
$this->seo_opt['url_find'] = array(
                                            utf8_chr(268),utf8_chr(269), // c
                                            utf8_chr(356),utf8_chr(357), // t
                                            utf8_chr(270),utf8_chr(271), // d
                                            utf8_chr(327),utf8_chr(328), // n
                                            utf8_chr(381),utf8_chr(382), // z
                                            utf8_chr(282),utf8_chr(283), // e
                                            utf8_chr(344),utf8_chr(345), // r
                                            utf8_chr(366),utf8_chr(367), // u
                                            );

$this->seo_opt['url_replace'] = array('c', 'c', 't', 't', 'd', 'd', 'n', 'n', 'z', 'z', 'e', 'e', 'r', 'r', 'u', 'u');
hroudel
 
Posts: 14
Joined: Thu Nov 27, 2008 3:43 pm

Advertisement

Postby empapa » Wed Dec 17, 2008 1:06 am

šđčćž ŠĐČĆŽ i need...
please help :(
empapa
 
Posts: 7
Joined: Mon Dec 08, 2008 9:01 am

Postby dcz » Sun Dec 21, 2008 9:40 am

Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21428
Joined: Fri Apr 28, 2006 9:03 pm

Postby unkn0wn » Mon Dec 22, 2008 1:58 pm

POLISH version

replacing ą , ć ,ę ,ł , ń ,ś ,ż ,ź with a, c, e, l, n, s, z, z

Open phpbb_seo_class.php and find : ( Otworz phpbb_seo_class.php i znajdz )
Code: Select all
$this->seo_path['phpbb_script'] =  $script_path;

After add : ( Ponizej dodaj )
Code: Select all
// --> Custom str_Replace arrays, to handle special cases properly
         $this->seo_opt['url_find'] = array(
               utf8_chr(261),utf8_chr(261), // a
               utf8_chr(262),utf8_chr(263), // c
               utf8_chr(280),utf8_chr(281), // e
               utf8_chr(321),utf8_chr(322), // l
               utf8_chr(323),utf8_chr(324), // n
               utf8_chr(346),utf8_chr(347), // s
               utf8_chr(377),utf8_chr(378), // z
               utf8_chr(379),utf8_chr(380), // z
         
      );
      $this->seo_opt['url_replace'] = array('a', 'a', 'c', 'c','e', 'e', 'l', 'l', 'n', 'n', 's', 's', 'z', 'z', 'z', 'z');


Find: ( Znajdz )
Code: Select all
$url = preg_replace('`\[.*\]`U','',$url);


Add after: ( Ponizej dodaj )
Code: Select all
$url = str_replace( $this->seo_opt['url_find'], $this->seo_opt['url_replace'], $url );


Tested and All works perfectly ! :]
unkn0wn
 
Posts: 1
Joined: Mon Dec 22, 2008 1:50 pm

Postby dcz » Tue Dec 23, 2008 10:12 am

Thanks for sharing ;)
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21428
Joined: Fri Apr 28, 2006 9:03 pm

Postby empapa » Tue Dec 23, 2008 10:25 pm


Its not for my language, so I made it for Croatian.

FOR CROATIANS:

Code: Select all
      // --> Custom str_Replace arrays, to handle CROATIAN special cases properly
      $this->seo_opt['url_find'] = array(utf8_chr(353),utf8_chr(352), // š
         utf8_chr(273),utf8_chr(272), // đ
         utf8_chr(382),utf8_chr(381), // ž
         utf8_chr(269),utf8_chr(268), // č
         utf8_chr(263),utf8_chr(262), // ć
      );
      $this->seo_opt['url_replace'] = array('s', 's', 'd', 'd', 'z', 'z', 'c', 'c','c', 'c');
empapa
 
Posts: 7
Joined: Mon Dec 08, 2008 9:01 am

Turkish Character Replacement

Postby saYRam » Sat Jan 24, 2009 11:40 am

For Turkish urls use this.

Code: Select all

// --> Custom str_Replace arrays, to handle special cases properly
      $this->seo_opt['url_find'] = array( utf8_chr(286),utf8_chr(287), // g
         utf8_chr(304),utf8_chr(305), // i
         utf8_chr(350),utf8_chr(351), // s
      utf8_chr(199),utf8_chr(231), //ç Ç
      utf8_chr(246),utf8_chr(214), //ö ö
      utf8_chr(252),utf8_chr(220), //ü ü

      );
      $this->seo_opt['url_replace'] = array('g', 'g', 'i', 'i','s', 's','c','c','o','o','u','u');


Thanks for phpbb3 Seo. Great Job!
saYRam
 
Posts: 7
Joined: Sat Jan 24, 2009 11:37 am

Re: About special characters remplacement

Postby bubo » Tue Mar 24, 2009 3:09 pm

Hi, I am from Bulgaria
I have a problem with the Cyrillic alphabet А,Б,В,Г,Д,Ж,З,Е,И,Й ..........
The titles of my forum are indicated as f21, f22, f23 ........
When I try to write the title of Cyrillic is not taken,this modification is not very effective for my forum :(

Please help me solve this problem?!

Thanks in advance!
bubo
 
Posts: 3
Joined: Tue Mar 24, 2009 2:29 pm

Re: About special characters remplacement

Postby bubo » Wed Mar 25, 2009 7:39 pm

already started to lose, probably no solution to this problem yet?


sorry for not good english
bubo
 
Posts: 3
Joined: Tue Mar 24, 2009 2:29 pm

Re: About special characters remplacement

Postby dcz » Sun Mar 29, 2009 9:22 am

I don't know how much meaning it would have to degrade Б to b or Д to a in urls, since I know very little about Russian language, but it's pretty easy to do applying the tweaks from this thread.

The full principle is provided here :
About special characters remplacement
All you have to do is add the characters you would like to replace, if it makes sens. Otherwise, the simple or mixed mod may be more suitable to you.

Another case where keywords in url can be interesting in language that cannot be replaced in Latin1 (like Persian) is when techy Latin1 terms ares often used in title, like css, html, design etc ... In such case, the title injecting will only keep these in urls.
But in general, a China board will just have no usable keyword to inject in url, that's how it is.

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21428
Joined: Fri Apr 28, 2006 9:03 pm

Re: About special characters remplacement

Postby bubo » Tue Mar 31, 2009 5:43 am

Thanks for the reply, I already put a simple modification!
bubo
 
Posts: 3
Joined: Tue Mar 24, 2009 2:29 pm

Re: About special characters remplacement

Postby Mikorist » Wed Apr 22, 2009 10:39 pm

This should be complete special chars rewrite for Serbian language.

Code: Select all
// --> Custom str_Replace arrays, to handle SERBIAN Latin and Cyrillic.
$this->seo_opt['url_find'] = array(
utf8_chr(353),utf8_chr(352), //Š š
utf8_chr(273),utf8_chr(272), //Đ đ
utf8_chr(382),utf8_chr(381), //Ž ž
utf8_chr(269),utf8_chr(268), //Č č
utf8_chr(263),utf8_chr(262), //Ć Ć
utf8_chr(1040),utf8_chr(1072), //А а
utf8_chr(1041),utf8_chr(1073), //Б б
utf8_chr(1042),utf8_chr(1074), //В в
utf8_chr(1043),utf8_chr(1075), //Г г
utf8_chr(1044),utf8_chr(1076), //Д д
utf8_chr(1026),utf8_chr(1106), //Ђ ђ
utf8_chr(1045),utf8_chr(1077), //Е е
utf8_chr(1046),utf8_chr(1078), //Ж ж
utf8_chr(1047),utf8_chr(1079), //З з
utf8_chr(1048),utf8_chr(1080), //И и
utf8_chr(1032),utf8_chr(1112), //Ј ј
utf8_chr(1050),utf8_chr(1082), //К к
utf8_chr(1051),utf8_chr(1083), //Л л
utf8_chr(1033),utf8_chr(1113), //Љ љ
utf8_chr(1052),utf8_chr(1084), //М м
utf8_chr(1053),utf8_chr(1085), //Н н
utf8_chr(1034),utf8_chr(1114), //Њ њ
utf8_chr(1054),utf8_chr(1086), //О о
utf8_chr(1055),utf8_chr(1087), //П п
utf8_chr(1056),utf8_chr(1088), //Р р
utf8_chr(1057),utf8_chr(1089), //С с
utf8_chr(1058),utf8_chr(1090), //Т т
utf8_chr(1035),utf8_chr(1115), //Ћ ћ
utf8_chr(1059),utf8_chr(1091), //У у
utf8_chr(1060),utf8_chr(1092), //Ф ф
utf8_chr(1061),utf8_chr(1093), //Х х
utf8_chr(1062),utf8_chr(1094), //Ц ц
utf8_chr(1063),utf8_chr(1095), //Ч ч
utf8_chr(1039),utf8_chr(1119), //Џ џ
utf8_chr(1064),utf8_chr(1096), //Ш ш
);
$this->seo_opt['url_replace'] = array( 's', 's', 'd', 'd', 'z', 'z', 'c', 'c', 'c', 'c', 'a', 'a', 'b', 'b', 'v', 'v', 'g', 'g', 'd', 'd', 'dj', 'dj', 'e', 'e', 'z', 'z', 'z', 'z', 'i', 'i', 'j', 'j', 'k', 'k', 'l', 'l', 'lj', 'lj', 'm', 'm', 'n', 'n', 'nj', 'nj', 'o', 'o', 'p', 'p', 'r', 'r', 's', 's', 't', 't', 'c', 'c', 'u', 'u', 'f', 'f', 'h', 'h', 'c', 'c', 'c', 'c', 'dz', 'dz', 's', 's' );
Mikorist
 
Posts: 1
Joined: Wed Apr 22, 2009 10:33 pm
Location: YouCanMail.Me

Re: About special characters remplacement

Postby dcz » Sun Apr 26, 2009 12:00 pm

Thanks for sharing ;)

I'm currently thinking about putting together a more integrated solution for custom replacements, as well as customizing the phpbb_seo class in general. We will as well (and finally!! :lol:) set the phpbb_seo_class.php file encoding to utf-8 without bom. This will allow us to bypass the utf8_chr pass even though, it's a good way to always get it to work.
Anyway, this was to tell you that what you did looks similar to what I just did here : Setup and cyrillic char-set

Though using a slightly different method, being a bit more comprehensive ;)

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21428
Joined: Fri Apr 28, 2006 9:03 pm

Re: About special characters remplacement

Postby Afr0man » Sun May 24, 2009 1:37 pm

hi all i have problem i need uncoding utf-8 in viewtopic

becose i trying and now working


Code: Select all
        $url = htmlentities($url, ENT_COMPAT, $this->encoding);
          $url = str_replace( array('č', 'Č'),'c', $url );
            $url = str_replace( array('ą', 'Ą'),'a', $url );
            $url = str_replace( array('ė', 'ė'),'e', $url );
            $url = str_replace( array('ę', 'Ę'),'e', $url );
            $url = str_replace( array('į', 'Į'),'i', $url );
            $url = str_replace( array('š', 'Š'),'s', $url );
            $url = str_replace( array('ų', 'Ų'),'u', $url );
            $url = str_replace( array('ū', 'Ū'),'u', $url );
            $url = str_replace( array('ž', 'Ž'),'z', $url );
            $url = preg_replace( '`&([a-z]+)(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i', "\\1", $url );
          $url = preg_replace( $this->seo_opt['url_pattern'] , '-', $url);
          $url = strtolower(trim($url, '-'));
          return empty($url) ? $type : $url;
       }           // --> Custom str_Replace arrays, to handle special cases properly
          $this->seo_opt['url_find'] = array(utf8_chr(260),utf8_chr(261),  // ą Ą -a
             utf8_chr(268),utf8_chr(269), // čČ-c
             utf8_chr(280),utf8_chr(281), // ęĘ-e
             utf8_chr(278),utf8_chr(279), // ėĖ-e
             utf8_chr(302),utf8_chr(303), // Įį-i
             utf8_chr(138),utf8_chr(154), utf8_chr(352),utf8_chr(353), // Šš-s
             utf8_chr(370),utf8_chr(371), // Ųų-u
             utf8_chr(362),utf8_chr(363), // Ūū-u
             utf8_chr(142),utf8_chr(158), utf8_chr(381),utf8_chr(382), // Žž-z
          );
          $this->seo_opt['url_replace'] = array('a', 'a', 'c', 'c', 'e', 'e', 'e', 'e','i', 'i', 's', 's', 's', 's', 'u', 'u', 'u', 'u', 'z', 'z', 'z', 'z');
            $url = preg_replace( '`&([a-z]+)(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i', "\\1", $url );
          $url = preg_replace( $this->seo_opt['url_pattern'] , '-', $url);
              $url = trim($url, '-');
          return empty($url) ? $type : $url;
       }



becose worl : Savižudybė replacing to savi-udyb-t232.html

i need to savizudybe-t232.html
Afr0man
 
Posts: 14
Joined: Tue Apr 21, 2009 1:16 pm

Re: About special characters remplacement

Postby SeO » Sun May 24, 2009 3:18 pm

You need to implement your custom replacements before :
Code: Select all
$url = htmlentities($url, ENT_COMPAT, $this->encoding);

Otherwise, they are just not used, because the coding already changed to html entities.
SeO
Admin
Admin
 
Posts: 6334
Joined: Wed Mar 15, 2006 9:41 pm

PreviousNext

Return to Advanced SEO URL

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 4 guests