grssnbchr
grssnbchr

Reputation: 2974

CakePHP 2.1: Sluggable Behavior with German Umlauts

I am using Marino Iglesias' SluggableBehavior to generate slugs while saving entries. Now, since my blog will also have some German posts, slugging should also work with Umlauts such as ä,ü,ö. E.g., "Schöne neue Welt" should become "schoene-neue-welt".

Right now, it becomes "sch-ne-neue-welt". I am thoroughly using utf-8 as my encoding - files, database, everything, so that should not be the reason.

I do not really understand what happens in the code, but the conversion between ö to oe for example should be included, from what I see in the code.

Anybody has ever dealt with this kind of problem?

Upvotes: 1

Views: 1170

Answers (2)

mark
mark

Reputation: 21743

should not be a problem with any of the newer versions.

try this one: https://github.com/dereuromark/cakephp-tools/blob/master/Model/Behavior/SluggedBehavior.php

I use it in all projects without issues.

Upvotes: 3

bfncs
bfncs

Reputation: 10316

From your question, I assume that you're using the Cake2 compatible version CakePHP-Sluggable-Behaviour by pronique.

You can pass an option translation when adding it to your model like this.

var $actsAs = array(
  'Sluggable.Sluggable' => array(
    'translations' => 'utf-8',
  ),
);

Still this doesn't work for me, too. I filed a bug report for this and use the behavior already recommended by mark.

Upvotes: 1

Related Questions