views:

10

answers:

2

Is there a way to allow foreign characters in .htaccess mod_rewrite character sets? i.e., a way to add foreign characters like ç and others to ([A-z]+) ?

A: 

you're using regular expressions, right? Take a look at this link: http://www.regular-expressions.info/unicode.html

Vidar Nordnes
+1  A: 

I’m not quite sure with what character encoding Apache interprets the data in configuration files like the .htaccess file. But you can express these characters with the hexadecimal notation \xhh like:

# ç in ISO 8859-1
RewriteRule \xE7 …
# ç in UTF-8
RewriteRule \xC3\xA7 …

Now all you need to know is how these characters are encoded when requested (in general either ISO 8859-1 or UTF-8).

Gumbo
so something like `RewriteRule /name/([A-z\xE7\xC3\xA7(and all other foreign characters allowed)]+) index.php?user=$1` ?
ina
@ina: No, when using multi-byte characters you need to use an alternation like `([A-z\xE7]|\xC3\xA7)+)`.
Gumbo