ASPX page with a User Control not working with localization
I have a project that is using ASPX and C#. All of the pages support localization through the overridden InitializeCulture method. Everything works very well with the exception of one page. This page has UserControl that is used 开发者_如何转开发for searching. I have noticed something odd with this page. If I execute a search, all of the French characters show up incorrectly. However, if I change the language to English and then back to French they show up as they should. The text is coming from a global resx file. First display:
Nous avons également effectué
After changing language and then back:
Nous avons également effectué
Any ideas why this is happening? It affects the entire page too, even parts that work properly on all other pages. The web.config file has the default encoding set to utf-8:
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
If you see two unrelated characters in place of a single character with a diacritic , you haven't told the client what it needs to know to treat the page as UTF-8, e.g.
Response.CodePage = 65001 ;
Response.CharSet = "utf-8" ;
This is excerpt from related topic.
I found several references to problems with French characters in UTF-8 in apparently unrelated apps:
http://www.dotnet247.com/247reference/msgs/37/189336.aspx
http://forums.mysql.com/read.php?103,220789,220789
Maybe give UTF-16 a try?
精彩评论