You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Haim Ashkenazi <ha...@gmail.com> on 2011/04/14 11:32:56 UTC

[users@httpd] RewriteRule and enabling pcre UTF-8 mode

Hi

I'm having a problem matching a single character in case of UTF8 characters
(hebrew in my case).

With rewrite rule (sorry for the hebrew in the example, but whenever you see
'?' it's a sign that it's not good :):

   - RewriteRule ^/users/(.)(.*) /users/$1/$2 [L]

when going to /users/משהכהן
I see in the logs:

> go-ahead with /var/www/html/users/?/?שהכהן [OK]


After searching the pcre docs, I've found that I have to enable UTF-8 mode.
In nginx I can do it like this:
rewrite (*UTF8)^/users/(.)(.*) users/$1/$2 last;

But the (*UTF8) syntax causes a syntax error in httpd 2.2.3 (CentOS 5.x).

Any ideas how to enable UTF-8 mode in RewriteRule?

Thanks in advance
-- 
Haim

Re: [users@httpd] RewriteRule and enabling pcre UTF-8 mode

Posted by Haim Ashkenazi <ha...@gmail.com>.
Hi

On Thu, Apr 14, 2011 at 1:16 PM, Nick Kew <ni...@webthing.com> wrote:

>
> On 14 Apr 2011, at 10:32, Haim Ashkenazi wrote:
>
> > But the (*UTF8) syntax causes a syntax error in httpd 2.2.3 (CentOS 5.x).
>
> What's the error message?  Can't see anything in mod_rewrite that would
> reject a valid pattern, so I wonder if the pcre you've linked was compiled
> without utf8 support?
>
Well, it's compiled with UTF-8 support, but I found that it's a different
version then what I'm running with nginx. The pcre installed on the nginx
machine accepts the (*UTF8) notation while the pcre on the httpd machine
doesn't. The way to enable UTF8 on the pcre in the httpd machine is to add
the '8' option at the end (e.g, /(.)(.*)/8). I don't know how to do it on
the rewrite rule as '/8' will mean something else there.

Thanks

-- 
Haim

Re: [users@httpd] RewriteRule and enabling pcre UTF-8 mode

Posted by Nick Kew <ni...@webthing.com>.
On 14 Apr 2011, at 10:32, Haim Ashkenazi wrote:

> But the (*UTF8) syntax causes a syntax error in httpd 2.2.3 (CentOS 5.x).

What's the error message?  Can't see anything in mod_rewrite that would
reject a valid pattern, so I wonder if the pcre you've linked was compiled
without utf8 support?

-- 
Nick Kew

Available for work, contract or permanent
http://www.webthing.com/~nick/cv.html


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org