首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

关于乱码的有关问题

2012-05-01 
关于乱码的问题我现在在模拟器中调用了htm页面,页面中显示的都很正常,但是在alert()提示信息的时候却出现

关于乱码的问题
我现在在模拟器中调用了htm页面,页面中显示的都很正常,但是在alert()提示信息的时候却出现了乱码的问题,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset="utf-8">
<meta content="minimum-scale=1.0, width=device-width, maximum-scale=1.0, user-scalable=no" name="viewport" /> 
function chkName(){
var username = document.getElementById('newName').value;
var userpass = document.getElementById('newPwd').value;
var url = window.location.toString();
if(username.length == 0 || username == "用户名/用户ID"){
//$(".loginPrompt").show();
//$(".loginPrompt span").text("请输入用户名!");
alert("请输入用户名!");
return false;
}
. . . . . . . .

这段代码是htm页面的,我把其放入到android模拟器重运行,alert()的提示框弹出的信息就是乱码,当然在网页中alert()出的也是乱码。请问有人知道怎么回事吗?

[解决办法]
设置一下网页的编码方式和你android上webview的编码方式看看。

热点排行