日期:2014-05-18  浏览次数:20782 次

Json中文乱码
$.post提交 读取出数据中文是乱码
action 中用将java数组转换成 jsonObject 
JSONObject jo=JSONObject.fromObject(resultMap);out.print(jo.toString());

控制台输出结果的
{"areas":[{"areaName":"亚洲","areaId":1},{"areaName":"欧洲","areaId":2},{"areaName":"美洲","areaId":3},{"areaName":"非洲","areaId":4},{"areaName":"大洋州","areaId":5},{"areaName":"ww","areaId":6},{"areaName":"ee","areaId":7}],"type":[{"typeName":"动作","typeDes":"播放视频使用","videoTypeId":1},{"typeName":"语言","typeDes":"播放视频使用","videoTypeId":2}
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!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-Type" content="text/html; charset=gb2312">
<title>Highcharts Example</title>

<!-- 1. Add these JavaScript inclusions in the head of your page -->
<script type="text/javascript" src="<%=basePath %>/js/jquery.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="<%=basePath %>/js/highcharts.js" charset="UTF-8"></script>
<!--[if IE]>
<script type="text/javascript" src="../js/excanvas.compiled.js"></script>
<![endif]-->
<script type="text/javascript">
$(function(){
   $.post("../findJsonArea.action","",function(data){
           var dataObj = eval('('+data+')');    
           $('#area').empty();
           $('#type').empty();
           $('#area').append("<option value='0'>-----请选择-----</option>");
           $('#type').append("<option value='0'>-----请选择-----</option>");
      //alert(dataObj['areas'][0]['areaName']);
    $.each(dataObj['areas'],function(key,value){
     $('#area').append('<option value="'+value['areaId']+'">'+value['areaName']+'</option>');
    });
             $.each(dataObj['type'],function(key,value){
     $('#type').append('<option value="'+value['videoTypeId']+'">'+value['typeName']+'</option>');
    });           
          
   });

页面端的显示是一堆????
.请各位多多指点