Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: UTF8 URL problem when used with RewriteRule |
|
Author |
|
jamie@acclaim
Joined: 23 Sep 2009 Posts: 2
|
Posted: Wed 23 Sep '09 7:59 Post subject: UTF8 URL problem when used with RewriteRule |
|
|
Hi All
We're trying to allow URLs to be in the format:
http://sitename/article/I_Am…_Sasha_Fierce
NOTE: the ellipse (…) in the above example is a UTF8 char (0xE280A6).
To do this we're using the following RewriteRule command:
RewriteRule ^/article/(.*) /cgi-bin/display.cgi?articlename=$1 [T=application/x-httpd-cgi,E=envarticle:$1,PT,L]
When we getenv("QUERY_STRING") the value of the ellipse is E23FA6 (we expected E280A6, 3F is ? (question mark)). So as an alternate method we tried creating our own variable called envarticle and stored the articlename in there (E=envarticle:$1). But this time when we getenv("envarticle") the result is a latin1 char 0x85.
If we don't use the redirect and enter the url directly:
http://sitename/article/display?action=&articlename=I_Am…_Sasha_Fierce
then genenv("QUERY_STRING") has the correct value "action=&articlename=I_Am%E2%80%A6_Sasha_Fierce" (percent encoded, I'm assuming the browser must have done it).
The question: Is there a config setting in apache that doesn't alter UTF8 chars when used with the RewriteRule?? or any workarounds?? or are we missing something?
We're running apache 2.2 on Windows Web Server 2003, cgi program is written in visual c v6.
Appreciate any help on this one!!!
Thanks
Jamie |
|
Back to top |
|
jamie@acclaim
Joined: 23 Sep 2009 Posts: 2
|
Posted: Tue 16 Nov '10 22:53 Post subject: Solved |
|
|
For anyone interested, we recently revisited the problem and resolved it.
The solution:
We installed Apache 2.2.17 and used the B flag in the RewriteRule to stop apache from modifying the URL.
The B flag was introduced in Apache 2.2.12. |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Tue 16 Nov '10 23:28 Post subject: |
|
|
Thanks for letting us know.
Steffen |
|
Back to top |
|
|
|
|
|
|