Rewriterule - special characters

Hi Chaps
Im sending variables from a link with accents - its in italian so they are on e’s, i’s etc etc

The link is created by the database, and i want to retrieve the page data using the title variable…alls fine until i come to a special character.

Example. One title in the db is ‘Popìne’

The htacess is: rewriteRule ^wines/([a-zA-Z]+)$ /wine2.php?wine=$1&lang=en [NC,L]

When i go to the link wines/Popìne i get a 404 error, with the message ‘wines/Popìne was not found on this server.’

Ive had a search around…ive even tried (.*)…but i cant get it to function…

thanks in advance

b

EDIT: ah, just realised - when i use (.*), the page can be shown, however the data isnt been pulled from the db…ie. the record can’t be pulled using the title as selector.On a second note to extend what i wrote before, to pull down the record i use:

$test1 = $_GET[‘wine’];
$test2 = str_replace( “-”, " ", $test1 );

If there is a better way (rather than using (.*), could somone let me know)…if the rewrite is ok, then i think ill need to pop over to the php boards)

Barney,

Yes, the special characters are a PITA - mod_rewrite (and regex) is very English-centric (non well suited to accented characters).

Saying that, though, I have had some success with non-alphanumeric characters by including them in a character range definition. Call that a MAJOR PITA for those using accented character languages!

Two Suggestions:

  1. Include accented characters as follows: ([a-zA-Zàáâãäåæç{etc}]+)

OR

  1. EXCLUDE undesired characters as follows: ([^./]+)

IMHO, it looks to be MUCH easier to allow matches for everything but undesired characters but be VERY careful about causing a loop (that’s why I included the dot character in the exclusion list).

Regards,

DK