I have a very simple view in an MVC .net core web site.
@model MvcSearch.Models.SearchModel
@{
ViewData["Title"] = "Index";
}
<h2>Buscador de Información</h2>
<div class="row">
@Html.Partial("SearchBox", Model.Search)
<hr />
<div class="container">
<div class="col-md-10">
<div id="results">
@if (Model.Results.Count() == 0)
{
<p>No hay nada que mostrar, ¡busca algo!</p>
}
</div>
</div>
</div>
</div>
Everything is working mint, however instead of the ó and the ¡ symbol, it shows this character: �
Never before happened this to me, and this is my first .net core project.
O looked for possible solutions here and here and others similar. But none quite addresses exactly my environment.
I tried the second link but I have some problems.
- Both references to System.Text.Encoding(4.3.0) and System.Text.Encoding.CodePages(4.3.0) are marked with a warning icon, however neither showed errors or warning during installation using Nuget Package Manager
I quite understand I have to use this line
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
But don't know where exactly, in startup.cs?
- I don't know what this means either
Call an Encoding.GetEncoding overload to retrieve the encoding. The Encoding.GetEncoding method will call the corresponding EncodingProvider.GetEncoding method to determine whether it can supply the requested encoding.
I'm not even sure this is the correct way of solving this. I also red that the scaffolded view files where built in an encoding different than the manually created files. Should I just create new empty View files and copy text into those new ones?