views:

130

answers:

1

I have Russian blog built with BlogEngine.NET 1.5.

I use Russian words in links encoded with URLEncode, so links are human-readable in most browsers - FF, Chrome, Opera (except for IE, but this is not the real problem with this browser). This idea is not mine, I borrowed it from Wikipedia - it uses encoded URLs on localized sites.

The real problem is that when I am trying to add comment in IE8 it fails (and only on production machine, development environment works fine).

Using Fiddler I found out that IE tries to send AJAX callback using WebForm_DoCallback to wrong address - it seems that it decodes URL, gets wrong characters and asks page with that wrong address from server and (of course) receives 404.

Here is how incorrect request from IE looks in Fiddler:

POST /ru/post/�������������-�����.aspx HTTP/1.1

Here is how FF makes same request and gets correct response:

POST /ru/post/%D0%92%D1%81%D1%82%D1%83%D0%BF%D0%B8%D1%82%D0%B5%D0%BB%D1%8C%D0%BD%D0%BE%D0%B5-%D1%81%D0%BB%D0%BE%D0%B2%D0%BE.aspx HTTP/1.1

I upgraded solution from default ASP.NET 2.0 for BE to ASP.NET 3.5 but this changed nothing.

Please note that I made some minor changes in BE to allow properly encoded UTF links - by default it wipes out percent symbol from links.

Can anybody tell me what wrong is with IE behavior here and how to fix it? Why development environment under ASP.NET Development works different from production machine under IIS6? Why IE does not decode link in address bar (like other browsers) but does it when making request?

A: 

This article may help.

From the article that explains what IE does:

What do web browsers do if they don't find any Content-Type, either in the http headers or the meta tag? Internet Explorer actually does something quite interesting: it tries to guess, based on the frequency in which various bytes appear in typical text in typical encodings of various languages, what language and encoding was used. Because the various old 8 bit code pages tended to put their national letters in different ranges between 128 and 255, and because every human language has a different characteristic histogram of letter usage, this actually has a chance of working.

Make sure that the first meta tag in the head section of the web page contains the following:

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
David Glass
Thank you for your answer David.I am quite aware about Unicode and that article written by Joel. Of course, I have proper meta tag. Just to be sure I moved it to be first above all and this didn't help.In general, site navigation as well as postbacks works well. The problem is only with AJAX callbacks made by ASP.NET built-in function WebForm_DoCallback. It seems that it has bug which results in incorrect handling of encoded URLs. I need to find some workaround but it looks pretty difficult for me because it all looks as "black box" behind my code.
koldovsky