0

I have an asp .net mvc4 application in which I have a problem in the encoding in this view:

@model Planning.Models.Affaire
@{

    Layout = "~/Views/Shared/Template.cshtml";
}

@section logout {
    <a href='@Url.Action("Index", "Calendar")'><img src="~/Content/images/restart-1.png"/></a>
    <a href='@Url.Action("Logout", "Home")' style="margin-left: 91.3%"><img src="~/Content/images/images.jpg" style="width:37px; height:37px" /></a>
    }
<head>
    <style>
    input {
    border: 1px solid #e2e2e2;
    background: #fff;
    color: #333;
    font-size: 1.2em;
    margin: 5px 0 6px 0;
    padding: 5px;
    width: 300px;
    }
        a {
            font-size:14px;
        }

        </style>
</head>
<br />
<br />
<h2 style="color:red ; margin-left: 40%">Ajouter une séquence</h2>
<br />
<br />

<form action="/Calendar/SaveSequence" method="post" style="margin-left: 33%; ">
           <div >
            <strong style="color:blue ">La description  de la séquence</strong>
            <input type="text" name="description" value="" style="margin-left:15.5%; width:50%" /> 
           </div>
            <br />

        <input type="text" name="id" value="@Model.Id_affaire" style="margin-left:15.5%; width:50%; visibility:hidden" />          <br />

        <p>
            <input type="submit" value="Enregistrer" />
        </p>

</form>
<div>
    @Html.ActionLink("Retour à la liste", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}

I get this result :

result

The problem is in the letter é: it's appears in <strong style="color:blue ">La description de la séquence</strong> and disappeared in <h2 style="color:red ; margin-left: 40%">Ajouter une séquence</h2> .

Why this happens? How can I fix it?

4

1 回答 1

2

一种不是很好但有效的解决方案是使用代码&eacute;

<strong style="color: blue">La description de la s&eacute;quence</strong>
<h2 style="color: red; margin-left: 40%;">Ajouter une s&eacute;quence</h2>.

更聪明的解决方案是在 head 标签中声明 UTF-8 编码,如下所示:

<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
于 2013-08-02T14:33:56.027 回答