Forum

Thread tagged as: Question, Problem

"Encoding" of German Umlaute in slugs/filenames

When creating a new page or a slug for a page heading, German Umlaute are simply swallowed by the system.
E. g. "Grüne Hügel" becomes "grne-hgel".
It would be much better–and nicer–, if they were "encoded" the German way. Thus "Grüne Hügel" would become "gruene-huegel" and the slug/filename would still be human (and search engine) readable.
Any chance, this could be incorporated in Perch? I bet, other languages would have similar problems.

For the time being I can make my client manipulate slugs by hand, of course.
Would be nice to have that happen magically, though.

Nils Mielke

Nils Mielke 3 points

  • 7 years ago

Just in case, transliteration depends on the language ("ü" => "u" in spanish).

Drew McLellan

Drew McLellan 2638 points
Perch Support

We already do that, but you need the PHP transliteration functions installed. Take a look at the diagnostics report - it should have an item for this.

Drew, the problem Nils is reporting was introduced in 2.6, the page slug is generated with javascript.

bump.

In Perch 2.6.* I have the same issue as Niels.

I requested activation of the PHP transliteration functions from the provider. We'll see how that works out.

Drew McLellan

Drew McLellan 2638 points
Perch Support

The next version uses the server transliteration. If you don't like the JavaScript version, leave the field empty and you'll get the server transliteration.

This did not change in 2.6.

In perch/core/lib/PerchUtil.class.php add right at the beginning of public static function urlify($string):


$replace = array( 'ü' => 'ue', 'Ü' => 'ue', 'ä' => 'ae', 'Ä' => 'ae', 'ö' => 'oe', 'Ö' => 'oe' ); $string = str_replace( array_keys( $replace ), array_values( $replace ), $string );


It seems to work properly! Thanks to Louis Bataillard https://support.grabaperch.com/index.php?pg=forums.posts&id=2632