[英]Encoding Spanish special characters in Page Title ASP.NET with UTF-8
我在aspx页面中使用带有特殊字符(á,é,í,ó,ú等)的Title。
Title =“信息经济学”
Page.aspx
<%@ Page Language="C#" Title="Información Económica" MasterPageFile="~/MyMaster.Master" AutoEventWireup="true" CodeBehind="InformacionEconomica.aspx.cs" Inherits="Company.WebIU.InformacionEconomica" %>
web.config中
<globalization culture="es-ES" uiCulture="es-ES" enableBestFitResponseEncoding="false" enableClientBasedCulture="false" fileEncoding="UTF-8" requestEncoding="UTF-8" responseEncoding="UTF-8" responseHeaderEncoding="UTF-8"/>
我的meta与charset="utf-8"
但是标题是错误的:
<!DOCTYPE html>
<html lang="es">
<head>
<meta name="tipo_contenido" content="text/html;" http-equiv="content-type" charset="utf-8" />
<title>
Informaci?n Econ?mica
</title>
就像使用“急性”
Title="Información Económica"
有300多个aspx页面,我不想全部替换
á by á
é by é
í by í
ó by ó
ú by ú
etc...
有什么建议么?
确保您使用正确的编码保存文件。 如果您使用的是Visual Studio
请查看“文件->高级保存选项”,然后选择Unicode感知的Encoding
例如Unicode (UTF-8 with signature)
。
还要确保您的aspx/html
文件具有以下meta
:
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
最后,通过其他浏览器检查您的页面,看看是否有任何变化。
您的文件是否另存为UTF-8? 如果不是,您可能需要按照此答案中的建议进行转换。
然后添加以下内容(从MSDN-为ASP.NET Web页面全球化选择一种编码 )
<configuration>
<system.web>
<globalization
fileEncoding="utf-8"
requestEncoding="utf-8"
responseEncoding="utf-8"
culture="en-US"
uiCulture="es-ES"
/>
</system.web>
</configuration>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.