views:

157

answers:

2

When some users of my ASP.NET app enter the following text

Je bénéficie d’un coaching

I get the following value in my Request.Form:

Je b�n�ficie d�un coaching

At first my page had the encoding set to Latin1, and I thought that changing it to Unicode (UTF8) using the following meta tag would help:

<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>

But after the change I still get those "blocks" in Request.Form.

Now the weird thing is, this happens when I submit the page which is being served by IIS (e.g http://localhost/myform.aspx). If I get the same html, save it locally, open the file in the browser directly (e.g. c:\myform.html) and submit it, all is fine, I see the unicode characters in my Request.Form as they should be.

Any tips? I am lost here...

A: 

You can try "charset=ISO-8859-1". I hope that help's.

RG
+1  A: 

The meta tag you mentioned ensures that the content of the page is rendered following the UTF-8 codepage, but doesn't inform how data posted should be handled. For that, you should add this attribute in your form tag:

<form accept-charset="utf-8" ....>

No idea why the behaviour is different when you run it through IIS and the file system, though.

rodbv