How to solve accentuation problems with ASP.NET MVC?

11

I'm having problems with accentuation in ASP.NET MVC 5.

I'm using Visual Studio 2013 Professional and the .Net 4.5 application. SQL Server 2008 and Entity Framework 6. The browser is Google Chrome upgraded and Windows is 8.1.

Example:

Where I want to appear "Endereço" is appearing "Endereço" .

How can I resolve this?

    
asked by anonymous 03.03.2014 / 00:22

5 answers

13

As I mentioned in the comments of this question, I solved the problem by adding this tag to my web.config file:

<globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="pt-br"/>

It looks like this:

There'sanotherthingI'vediscoveredthatmightalsoaffectcharacterrecognition,whichisthefileformat.

Iagainhadissueswithcharacterrecognitionafterimplementingthistagintheproject'sweb.config.

Thistimeitwasonlyafewpageswheretheword"Descrição" appeared as "Descri??o" .

I tried some modifications, like putting the encode in the tag with "iso-8859-1". This only made the situation worse because Bootstrap is not compatible and the previous problem has returned.

So I decided to see the format of the cshtml files and found that on those pages that were giving this problem the encode was ANSI. If you open the file with notepad, for example, and ask "Save As", the window for choosing the file and destination location shows the current encode of it. So all I did was change to utf-8 and save. And then those pages returned to show the characters correctly.

How do I change the default of these files to ANSI? I do not know!

But finally, problem solved again.

    
03.03.2014 / 19:17
3

I resolved by putting in web.config :

<system.web>
    <globalization
         fileEncoding="iso-8859-1"
         requestEncoding="iso-8859-1"
         responseEncoding="iso-8859-1"
         culture="pt-BR"
         uiCulture="pt-BR"
    />
</system.web>
    
11.03.2016 / 22:11
2

Check your configuration file (% with%). Add the tag below within WEB.CONFIG , it should work.

<globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-
8" culture="pt-br"/>
    
05.07.2016 / 16:14
1

In my case, I modified the encoding of the saved file.

I made the following step in VS

"File" menu - > "Advanced Save Options" and Select "Unicode (UTF-8 with signature) -Codepage 65001"

Using Asp.net Core

It worked.

    
11.08.2016 / 18:16
0

I have the solution to your problem, follow these steps:
1. Open the file containing the words with accent;
2. Go to File-> Save As ;
3. And there, click on the button of the Save button and, Save with Encoding . 4. Then choose the UTF-8 option. 5. Do not worry if VS asks you to replace the file.

Start the project and see.

    
12.09.2017 / 09:46