Problem with Charset between Asp.Net MVC with Entity Framework and SQL Server

1

I have a problem that all the values that come from the SQL Server database, are with accent problem.

When they are direct written words in HTML , it does not give this problem. What is strange is that the words are written correctly in the bank, without any problem in accentuation, the problem is the time to present these values, such as:

TherightwordwouldbeJoseph,andlookhowitisinthedatabase:

I'vealreadytriedsettingglobalizationtoweb.config,likethis:

<globalizationculture="pt-BR" uiCulture="pt-BR" requestEncoding="iso-8859-1" responseEncoding="iso-8859-1" fileEncoding="iso-8859-1" />

More did not work out.

EDIT:

The values are correct when loaded into the Controller, see the respective examples in Bank, Controller and View:

Bank:

Controller:

View:

    
asked by anonymous 19.07.2016 / 15:38

1 answer

0

This is wrong here:

<globalization culture="pt-BR" uiCulture="pt-BR" requestEncoding="iso-8859-1" responseEncoding="iso-8859-1" fileEncoding="iso-8859-1" />

The ASP.NET MVC standard is UTF-8 encoding. There is no reason to use ISO-8859-1 , which is more limited.

Switch to:

<globalization culture="pt-BR" uiCulture="pt-BR" requestEncoding="UTF-8" responseEncoding="UTF-8" fileEncoding="UTF-8" />

Or, simply remove requestEncoding , responseEncoding and fileEncoding .

    
12.09.2016 / 14:46