用JSP转换中文字符在WAP里显示
<%@ page language="java" contentType="text/vnd.wap.wml;charset=UTF-8"%>
<%!
public static String toUTF(String inPara)
{
char temChr;
int ascChr;
int i;
String rtStr=new String("");
if(inPara==null)
{
inPara="";
}
for(i=0;i<inPara.length();i++)
{
temChr=inPara.charAt(i);
ascChr=temChr+0;
System.out.println(ascChr);
System.out.println(Integer.toBinaryString(ascChr));
rtStr=rtStr+"&#x"+Integer.toHexString(ascChr)+";";
}
return rtStr;
}
%>
<?xml version="1.0"?>
<!-- created by WAPtor (http://www.waptop.net/) -->
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<!-- THIS IS THE FIRST CARD IN THE DECK -->
<card id="MainCard" title="This is a first card">
<p align="center">
This is a sample text
你好
<%
out.println("nihao");
%>
<br/>
<%
out.print(toUTF("你好大幅度法"));
%>
<br/>
你好的</p>
</card>
</wml>