0

Hi all,

I want to replace these charachters:

Æ,Ø,Å,æ,ø,å, with,
AE,OE,AA,ae,oe,aa

I thoght I could use preg_replae this way to accomplish that, but if i write this word in the form: "Bælter" - All that is left to be inserted into the DB is "B" - So I am removing everything from the special charachter away from the string...

This is what i have:

$search = array('/Æ/', '/Ø/', '/Å/', '/æ/', '/ø/', '/å/', '/ /');
$replace = array('AE', 'OE', 'AA', 'ae', 'oe', 'aa', '-');
$vare_gruppe_url = preg_replace($search,$replace,$vare_gruppe_url);

I am using utf-8 - and have read that preg_replace doesnt work too well with 2 byte charachters, i think that was how it was described..

Can someone point out why this is happening and not working?

Basically what i want is this:

"Bælter" should become "Baelter".

Regards, Klemme

2
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by klemme
0

Right, How do I implement the 'U' modifier in the pattern, have you any experience with that?

I have tried it different ways, with no succes so far :-/

$search = array('/Æ/', '/Ø/', '/Å/', '/æ/', '/ø/', '/å/', '/ /');
$replace = array('AE', 'OE', 'AA', 'ae', 'oe', 'aa', '-');
$vare_gruppe_url = preg_replace($search,$replace,$vare_gruppe_url);
0
$search = array('/Æ/u', '/Ø/u', '/Å/u', '/æ/u', '/ø/u', '/å/u', '/ /');
$replace = array('AE', 'OE', 'AA', 'ae', 'oe', 'aa', '-');
$vare_gruppe_url = preg_replace($search,$replace,$vare_gruppe_url);

It should be called preg_remove..

I am left with only B if $vare_gruppe_url = "Bælter"..

Any help is appreciated!

Edited by klemme: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.