Problems with Javascript accentuation - Asp.net Core

Asked

Viewed 361 times

0

Every text I write in Portuguese on buttons, etc, gets problems of accentuation in javascript. What I need to do?

//Trecho do meu arquivo _Layout

<!DOCTYPE html>
<html class="no-js css-menubar" lang="en">
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <meta name="description" content="bootstrap admin template">
    <meta name="author" content="">
    <title>My System</title>
    <link rel="apple-touch-icon" href="../../assets/images/apple-touch-icon.png">
    <link rel="shortcut icon" href="../../assets/images/favicon.ico">
    <!-- Stylesheets -->
    <link rel="stylesheet" href="../../assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="../../assets/css/bootstrap-extend.min.css">
    <link rel="stylesheet" href="../../assets/css/site.min.css">
    <!-- Plugins -->
    <link rel="stylesheet" href="../../assets/vendor/animsition/animsition.css">
    <link rel="stylesheet" href="../../assets/vendor/asscrollable/asScrollable.css">
    <link rel="stylesheet" href="../../assets/vendor/switchery/switchery.css">
    <link rel="stylesheet" href="../../assets/vendor/intro-js/introjs.css">
    <link rel="stylesheet" href="../../assets/vendor/slidepanel/slidePanel.css">
    <link rel="stylesheet" href="../../assets/vendor/flag-icon-css/flag-icon.css">
    <!-- Fonts -->
    <link rel="stylesheet" href="../../assets/fonts/web-icons/web-icons.min.css">
    <link rel="stylesheet" href="../../assets/fonts/brand-icons/brand-icons.min.css">
    <link rel='stylesheet' href='http://fonts.googleapis.com/css?family=Roboto:300,400,500,300italic'>

@using Microsoft.AspNetCore.Identity

@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager

@if (SignInManager.IsSignedIn(User))
{
    <form asp-area="" asp-controller="Account" asp-action="Logout" method="post" id="logoutForm" class="navbar-right">
        <ul class="nav navbar-nav navbar-right">
            <li>
                <a asp-area="" asp-controller="Manage" asp-action="Index" title="Manage">Olá @UserManager.GetUserName(User)!</a>
            </li>
            @*<li>
                    <button type="submit" class="btn btn-link navbar-btn navbar-link">Log out</button>
                </li>*@

            <li class="dropdown">
                <a class="navbar-avatar dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false"
                   data-animation="scale-up" role="button">
                    <span class="avatar avatar-online">
                        <img src="../../assets/portraits/jalber.jpg" alt="...">
                        <i></i>
                    </span>
                </a>
                <ul class="dropdown-menu" role="menu">
                    <li role="presentation">
                        <a href="javascript:void(0)" role="menuitem"><i class="icon wb-user" aria-hidden="true"></i> Perfil</a>
                    </li>
                    <li role="presentation">
                        <a href="javascript:void(0)" role="menuitem"><i class="icon wb-settings" aria-hidden="true"></i> Configurações</a>
                    </li>
                    <li class="divider" role="presentation"></li>
                    <li role="presentation">
                        @*<a href="javascript:void(0)" role="menuitem"><i class="icon wb-power" aria-hidden="true"></i> Sair</a>*@
                        <a href="@Url.Action("Logout", "Account") " role="menuitem"><i class="icon wb-power" aria-hidden="true"></i> Sair</a>
                    </li>
                </ul>
            </li>

        </ul>




    </form>
}
else
{
    <ul class="nav navbar-nav navbar-right">
        <li><a asp-area="" asp-controller="Account" asp-action="Register">Cadastrar</a></li>
        <li><a asp-area="" asp-controller="Account" asp-action="Login">Login</a></li>
    </ul>
}

inserir a descrição da imagem aqui

  • how are the files ? I suggest you save them as utf-8

  • Have you tried putting charset="utf-8" in your tag? If the problem is in the file js, add the atributo in the script. Example: <script src="seu_src" charset="utf-8"> </script>

  • 1

    @Jorge looking closely, I think the problem should be with the source... html thing same... I’ve tried <html class="no-js css-menubar" lang="en"> but it didn’t work.

  • 1

    @Jalberromano, tries to add content-type to your meta tags: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />, but a recommended and effective way is to replace special characters with their HTML Number, for example: á = &#225; Here has a list that can help.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.