June 25, 2007

Encoding Problem and Solution For Asp.Net Ajax

I have been setting the encodings (for Turkish encoding) for my Asp.Net sites as follows, which is a standard way and working perfectly:

<globalization requestEncoding="windows-1254" responseEncoding="windows-1254" fileEncoding="windows-1254" />

But when I started using Ajax Asp.Net 1.0 with the same settings, I got scrambled characters for Turkish characters. This seems to be a bug.

I posted the problem to Asp.Net forums and stmarti comes with a workaround for it that saves a lot of work of saving every page of the site with UTF-8 encoding.(http://forums.asp.net/p/1115099/1726111.aspx#1726111)

Here is the workaround setting:
<globalization requestEncoding="utf-8" responseEncoding="utf-8" fileEncoding="windows-1254" responseHeaderEncoding="windows-1254" />

You can change the windows-1254 to any encoding that will work for you.
Tankut

3 comments:

SataniC666 said...

Tankut dude you saved my day thanks a lot!

In Turkish
Tankut kardeş allah razı olsun.

Konstantinidis Konstantinos said...

Hi from greece!
thx m8 your post helped me

M.İkbal KAYA said...

çok teşekkürler gerçekten. 4 gündür bunu düzeltmekle uğraşıyorum. ajax extensionlarıyla ilgisi olduğunu düşünmezdim. çok iyi oldu çok teşekkürler