Incorrect characters in ModelBinding

I have a problem, I am developing an asp.net mvc project. The website is in Turkish. When I publish this site for IIS, Turkish characters go crazy on web pages, so I set globalization in my web.config as

<globalization fileEncoding="iso-8859-9" requestEncoding="iso-8859-9" responseEncoding="iso-8859-9"/>

After that, Turkish characters were indicated correctly.

But now I have another problem, when I enter Turkish text into the input text, and then POST for my action with the controller, Turkish characters go crazy again.

I correctly tracked the HTTP messages of the Turkish text POST ex: If I enter "Yücel" (ü is the Turkish character) for input, I looked at HttpAnalyzer, I can see that the Postal Data is "Yücel". When I look at my action parameter settings, which are automatically bound by MVC, I see "Yüčcel".

Do you have any suggestions to fix this problem?

+3
source share
1 answer

I fixed the problem, what I did

  • Delete the next item from web.config, so the default encoding will be used (UTF-8)

    <globalization requestEncoding="utf-8" responseEncoding="utf-8"/>

  • Remove SiteMaster from my site.

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9"/>

+2
source

Source: https://habr.com/ru/post/1722312/


All Articles