最近使用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
现在有点束手无策了,向大家求助。
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
现在有点束手无策了,向大家求助。
解决方案 »
- 投票系统
- 文件操作
- 在asp.net里做图片翻页效果失败,高手给点意见....
- asp.net将视频转换成flv格式!!
- 我网站发布到空间后,查不到数据
- 我适合读<<Java Script高级程序设计>>这本书吗
- c# 如何发送内容为一个网页的邮件,网页的url由自己设定?
- Table中的Iframe问题
- 无法找到 Imports“system.data.ado”的命名空间或类型“ado"
- 水晶报表自带 导出,打印功能速度非常慢 非常慢
- Global.asax中的Application_Error老是有提示文件不存在的错误
- 为什么vs2008中debug的时候,int型的参数都以16进制形式显示出来,
<%@ 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空间真不知道手机看了到底是什么样。
<%@ 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" />文字输入要半角
解决方法:
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">
在前台输入用户名:用户名,后台获取的时候就变成了"用户名/Oame"获取代码如下:
string txtName = context.Request.Form["username"].Trim();