最近使用vs2005+.net2.0(c#)用移动控件做wap网站,用模拟器m3g访问时页面上的中文(页面上本身的和读出来的)都变成了乱码,而openwave7则没问题。看了下天涯的手机版发现他们的网页头是<?xml version="1.0"   encoding="utf-8"?> 这个,而.net生成wml文件里网页头是<?xml version="1.0"?>这个,为什么我的没有encoding="utf-8",是因为这个原因才变成乱码的?以下几个步骤都做了,没有效果。1,config里设置<globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8"/>
2,网页都用vs2005里的高级保存选项用 utf-8无签名代码页65001 保存过了。
3,在iis里 
   在MIME Map部分,点击File Type并且输入以下信息:     
  Associated Extension       MIME Type   
  wml                     text/vnd.wap.wml   
  wmlc                  application/vnd.wap.wmlc   
  wbmp                     image/vnd.wap.wbmp   
  wmlsc             application/vnd.wap.wmlscriptc   
  wmls                text/vnd.wap.wmlscript   
  wsc              application/vnd.wap/wmlscriptc  
现在有点束手无策了,向大家求助。

解决方案 »

  1.   

    手动加如何加?我把<?xml version="1.0"  encoding="utf-8"?> 这段直接放在aspx里,被无视了,菜鸟一只大侠说的详细点吧。
      

  2.   

    <html><meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
      

  3.   

    谢谢楼上这位大哥这是我aspx里的原始代码:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
    <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %><html xmlns="http://www.w3.org/1999/xhtml">
    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>  //刚才加进去的
    <body>
        <mobile:Form id="Form1" runat="server">
            <mobile:Label ID="Label1" Runat="server">王1</mobile:Label>
            
        </mobile:Form>
    </body>
    </html>
    这是运行后,从m3g里看的代码。<?xml version='1.0'?>
    <!DOCTYPE wml PUBLIC '-//WAPFORUM//DTD WML 1.1//EN' 'http://www.wapforum.org/DTD/wml_1.1.xml'><wml><head>
    <meta http-equiv="Cache-Control" content="max-age=0" />
    </head>
    <card>
    <p>王1</p></card>
    </wml>被完全重写了,从m3g里看是乱码,从查看源代码里看则是正常显示。还有openwave不管怎么折腾都是正常的,我现在没有网上的wap空间真不知道手机看了到底是什么样。
      

  4.   

    厄,没人理,自己顶上去还有vs的.net移动web作出来好像会根据浏览器的不同自动生成相应的代码,pc端的又不一样了。
      

  5.   

    <?xml version="1.0" encoding="utf-8"?>
    <%@ Page Language="C#" AutoEventWireup="true"   ContentType="text/html"  CodeFile="Index.aspx.cs" Inherits="Index1"   ResponseEncoding="utf-8" %>%>
    <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />文字输入要半角
      

  6.   

    我刚开始时也是会出现乱码
    解决方法:
    1、文字输入用半角
    2、config里设置<globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8"/>
    3、用dreamweaver建立标准文件,文件类型:xhtml mobile 1.0
    文件头部:
    <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
      

  7.   

    兄弟,我也遇到了相同的问题,vs2010+.net2.0(c#) 制作wap网站
    在前台输入用户名:用户名,后台获取的时候就变成了"用户名/Oame"获取代码如下:
    string txtName = context.Request.Form["username"].Trim();