| |
|
| :: |
| Author |
Message |
digdigger
Joined: 26 Sep 2007 Posts: 12
|
Posted: Wed Sep 26, 2007 2:27 pm Post subject: Html German Entities |
|
|
Hi, I like your SEO and installed the Premod. Everythings works fine, so great thanks for your hard work.
So my board is in german language and we use many Entities in the topic-titles like ü/ö/ä ... f.e. "Führerschein" (driving licence) ...
The SEO MOD removes the entities so the url is at least "fuhrerschein"
Are any possibilies for ¨ to replace
ä = ae
ö = oe
ü = ue
so "Führerschein" changes to "fuehrerschein", which is correct.
So I also see that "ß" ist changing to "sz" ... in german is it better to change it into "ss" (Faß is not "fasz", its "fass")
Where I can change the values? I searched in all files, but I didn't found anything to change.
I hope you can help me!
Thanks a lot for your efforts. Regards from brazil,
digdigger |
|
|
| Back to top |
|
 |
|
 |
digdigger
Joined: 26 Sep 2007 Posts: 12
|
Posted: Wed Sep 26, 2007 9:44 pm Post subject: Re: Html German Entities |
|
|
So, I found a solution for myself.
in phpbb_seo_class.php
FIND
| Code: | * Prepare Titles for URL injection
*/
function format_url( $url, $type = 'topic' ) {
$url = preg_replace('`\[.*\]`U','',$url);
$url = htmlentities($url, ENT_COMPAT, $this->encoding);
$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;
}
|
REPLACE with
| Code: | * Prepare Titles for URL injection
*/
function format_url( $url, $type = 'topic' ) {
$url = preg_replace('`\[.*\]`U','',$url);
$url = htmlentities($url, ENT_COMPAT, $this->encoding);
$url = preg_replace( '`&([a-z]+)(acute|circ|grave|ring|cedil|slash|tilde|caron);`i', "\\1", $url );
$url = preg_replace( '`&(auml);`i','ae',$url);
$url = preg_replace( '`&(ouml);`i','oe',$url);
$url = preg_replace( '`&(uuml);`i','ue',$url);
$url = preg_replace( '`&(Auml);`i','ae',$url);
$url = preg_replace( '`&(Ouml);`i','oe',$url);
$url = preg_replace( '`&(Uuml);`i','oe',$url);
$url = preg_replace( '`&(szlig);`i','ss',$url);
$url = preg_replace( '`(%)`i','prozent',$url);
$url = preg_replace( '`&(euro);`i','euro',$url);
$url = preg_replace( $this->seo_opt['url_pattern'] , '-', $url);
$url = strtolower(trim($url, '-'));
return empty($url) ? $type : $url;
} |
I replaced % and € in the topic title with the full name, too.
And I deleted in the second preg_replace line "uml" and "lig"
It's not perfect, because if you need >> Ë ë Ï ï ¨ Ÿ ÿ << you have to insert the replace, too. If you do not want to replace ß with ss, so delete the line and insert "lig" in the second preg_replace line. The "lig" you need also for >> Æ æ Œ œ <<
I think, you do not need for each entity a single line, but I do not know to bundle it. So, for me it's today the fastest solution. If you have any other ideas, please let me know.
I hope that is useful for some German SEO-Board. |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14327
|
Posted: Thu Sep 27, 2007 9:30 am Post subject: Re: Html German Entities |
|
|
Yes, the mods does not handle all possible cases, since they are many, and are not necessary for most.
But I started to design a general way to filter any additional letter that could require it in this post : http://www.phpbb-seo.com/boards/advanced-seo-url/discussions-vt1229-15.html#9596
The idea is to do it in one line using str_replace() since preg_replace isn't necessary here. The suggested method will work with utf-8 directly and won't require to set the replacement array each time the format_url method is called.
In your case it would mean :
Open phpbb_seo_class.php and find :
| Code: | | $this->seo_path['phpbb_script'] = $script_path; |
After add :
| Code: | // --> Custom str_Replace arrays, to handle special cases properly
$this->seo_opt['url_find'] = array(utf8_chr(196),utf8_chr(228), // ae
utf8_chr(246),utf8_chr(214), // oe
utf8_chr(252),utf8_chr(220), // ue
utf8_chr(223), // ss
utf8_chr(37 ), // %
utf8_chr(8364), // €
);
$this->seo_opt['url_replace'] = array('ae', 'ae', 'oe', 'oe', 'ue', 'ue', 'ss', 'prozent','euro'); |
Find :
| Code: | | $url = preg_replace('`\[.*\]`U','',$url); |
After add :
| Code: | | $url = str_replace( $this->seo_opt['url_find'], $this->seo_opt['url_replace'], $url ); |
I don't know if there is an uppercase for ß, but you should have gotten the idea.
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
digdigger
Joined: 26 Sep 2007 Posts: 12
|
Posted: Fri Sep 28, 2007 5:09 am Post subject: Thank you!!! Works fine!!! |
|
|
Hi,
thank you very much for the code snippet. It works fine and I think it's a better solution than my homemade try .... ('cause I'm a php newbie)
A uppercase for ß does not exist - but thanks that you think about it.
Once again thank you for you support - if you wanna see it live, so visit
http://brasilienfreunde.net
Greetz from Brazil, digdigger
So I opened another thread with other questions:
http://www.phpbb-seo.com/boards/phpbb3-mod-rewrite/discussions-vt1624.html#11737 |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14327
|
|
| Back to top |
|
 |
|
|
| Navigation |
Similar Topics |
|
|
|
|
|
|
|