Forum Moderators: phranque

Message Too Old, No Replies

strange htaccess problem

it messes with non-latin characters

         

muszek

7:02 pm on Dec 9, 2004 (gmt 0)

10+ Year Member



here's what I need to do:
1. take two values taken from a form on utf-8 encoded page ($_POST[one] and $_POST[two]).
2. create an URL containing them.
3. on that URL's page, display correctly those values.

not a problem with plain PHP.
example: 3 Polish letters "ąśł" entered.

I used urlencode function and got that address (in fact it doesn't matter if I do use it... it works all right in either case):
target.php?one=%C4%85%C5%9B%C5%82

Displays all right.

Now the problem begins.

I want a short url, so I use this rule:
RewriteRule ^n-([^\.]*).htm$ target.php?one=$1 [L]

And I get messed up characters!
HTML source for correct characters: ąśł
HTML source for characters passed via htaccess: ä…ĺ›ĺ‚

Please tell me what do I do wrong and what should I do?

Edit: unfortunately webmasterworld messes up with characters too, so I can't show them correctly. Hopefully you get the idea...

jdMorgan

5:21 pm on Dec 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That *is* a strange problem!

About the only thing I can think of is that RewriteRule has a [NE] (noescape) flag that tells it not to escape the character "%" in rewritten URLs. You might want to check the documentation of that flag to see if it sounds like it might help. If you pass a double-esacaped encoded character to a browser, it might cause an error, but this is just a guess.

Jim

muszek

3:11 am on Dec 11, 2004 (gmt 0)

10+ Year Member



thanks. i came up with an idea to ereg_replace % to underscores and switching it back after it's gone through htaccess. it works.