zoukankan      html  css  js  c++  java
  • asp.net 页面编码 设置的几种方法

    1如果要为整个项目设置页面编码,那么就可以在 Web.config 文件中添加一个 Globalization 属性,然后设置它的 fileEncoding、requestEncoding,和 responseEncoding 特性:

    <configuration>
        <system.web>
                <globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="zh-CN" uiCulture="zh-CN" fileEncoding="utf-8"/>
            </system.web>
    </configuration> 

    2如果要为单独的页面设置编码,那么就可以设置 @ Page 指令的 RequestEncoding 和 ResponseEncoding 特性: 
    <%@ Page RequestEncoding="utf-8" ResponseEncoding="utf-8" %>

    3有时我们已经在配置文件中将整个站点的编码设置为gb2312,但某个页面却需要使用utf-8,这时我们可以在配置文件configuration节下新增location节点: 
    程序代码

    <location path="Test.aspx">
        <system.web>
            <globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="zh-CN"/>
        </system.web>
    </location> 

  • 相关阅读:
    poj3718 Facer's Chocolate Dream
    codeforces 917D Stranger Trees
    uoj#349 【WC2018】即时战略
    bzoj5153 [Wc2018]州区划分
    bzoj5152 [Wc2018]通道
    loj2001[SDOI2017]树点染色
    loj2000[SDOI2017]数字表格
    Atcoder arc092
    bzoj4826[hnoi2017]影魔
    bzoj4827 [hnoi2017]礼物
  • 原文地址:https://www.cnblogs.com/cmblogs/p/3991413.html
Copyright © 2011-2022 走看看