IIS 7 and Above
URL Rewrite Module
URLs with UTF-8 characters
Last post Apr 23, 2009 12:22 PM by tusenmiljarder
Apr 03, 2009 04:31 AM|tusenmiljarder|LINK
The RewriteModule is preventing my IIS7 from handling URLs containing UTF-8 characters.
Previously I used isapi_rewrite, but can't get it to work with my IIS7 (x64).
When I have at least one active rule all URL:s containing UTF-8 characters (even in QueryString)results in an 500.50-error message.
Faild request tracing reveals the error code:
"No mapping for the Unicode character exists in the target multi-byte code page. (0x80070459)"
I have set up a test at the default web site in IIS7:
My test url is http://localhost/iisstart.htm?subject=åäö
The error only appears when my test rule (or any related or unrelated rule) is enabled, and when using Internet Explorer (Firefox is url-encoding the extended cahracters before sending it to the server)
My test rule:
Rewrite to: /iisstart.htm
I need help to to resolve this! I want to use the module, but still be able to allow URLs with UTF-8 characters.
Apr 07, 2009 02:06 PM|ruslany|LINK
Unfortunately this is how the URL rewriter works. It tries to convert query string to Unicode and it cannot do that for this query string because it does not know the encoding that was used to encode those characters on the query string. If you do not have
the rewriter then no other components in IIS touch the query string hence the request succeeds.
The fact that IE does not encode the query string when it sends a request looks like a bug and we will follow up with IE team to confirm that.
Apr 14, 2009 08:46 AM|Doggy8088|LINK
Can you descirbe more detail about how URL rewriter deal with the Path or Query String encoding?
You said "It tries to convert query string to Unicode". Do you mean it tires to convert query string to Unicode after urldecode each key/value parts in the query strings?
I just wondered why URL rewriter doesn't just append the query string AS-IS?
Apr 21, 2009 12:45 AM|ruslany|LINK
The URL Rewrite 1.1 release has a fix for a bug related to handling unicode query strings. It is highly recommended to upgrade to that release.
Here is more informaiton about this release
Apr 21, 2009 04:58 AM|Doggy8088|LINK
I have been installed URL Rewrite 1.1 on my machine. I am also found another problem on URL Rewrite 1.1.
When I pass a query string with "Big5" encoding in the url, the URL Rewrite will just response HTTP 502.
The problem url will like this:
As you can see, the query string is not URL-encoded. There are two different behavior in different browsers. For this sample URL:
For this sample url that request to IIS/ASP.NET will works just fine. But, when request this url throught URL Rewrite Module will just failed.
I think URL Rewrite Module should treat this kind of url that unable to URL-decoded QueryString just ignored URL-decode/encode process to avoid this error occur. Please understand that this kind of URL are appear everywhere in the world wide web.
What do you think?
Apr 21, 2009 11:57 AM|ruslany|LINK
What's the error details that you get with 502? Also, can you post or email me at ruslany at microsoft dot com the rewrite rules that you have?
Apr 21, 2009 12:25 PM|DanielVL|LINK
Please enable FREB (FRT) and send the XML log file to Ruslan too. Thanks.
Apr 22, 2009 05:11 AM|Doggy8088|LINK
I have been sent the email with FRT xml logs to Ruslan.
Apr 23, 2009 12:22 PM|tusenmiljarder|LINK
It works for me now with the 1.1 release. Thanks!