一个aspx页面具有utf-8编码 [英] One aspx page to have utf-8 encoding

查看:276
本文介绍了一个aspx页面具有utf-8编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该怎么做才能将一个aspx页面更改为utf-8编码?

What should I do to change one aspx page to have utf-8 encoding?

我的web.config具有以下代码:

my web.config has the following code:

<system.web>
  <globalization
     requestEncoding="utf-8"
     responseEncoding="utf-8"/>
</system.web>

尝试过:

meta http-equiv="Content-Type" content="text/html; charset=UTF-8" 

不起作用.

推荐答案

尝试一下;

<configuration>
 <system.web>
  <globalization
    fileEncoding="utf-8" 
    requestEncoding="utf-8" 
    responseEncoding="utf-8"
    culture="en-US"
    uiCulture="de-DE"
   />
 </system.web>
</configuration>

要设置单个页面的编码,请设置@ Page指令的RequestEncodingResponseEncoding属性:

To set the encoding for an individual page, set the RequestEncoding and ResponseEncoding attributes of the @ Page directive:

<%@ Page RequestEncoding="utf-8" ResponseEncoding="utf-8" %>

或者您可以像这样使用location:

Or you can use location like this:

<location path="home.aspx">
    <system.web>
        <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
    </system.web>
</location>

了解更多:如何:选择用于ASP.NET网页全球化的编码

这篇关于一个aspx页面具有utf-8编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆