Pārlūkot izejas kodu

处理特殊字符

yangbiao 9 gadi atpakaļ
vecāks
revīzija
4beaabf977

+ 8 - 3
display-server/web/res/js/base/jcl.js

@ -519,7 +519,8 @@ define(["zepto"],function($){
519 519
			if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@")
520 520
				.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]")
521 521
				.replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) {
522

522
						
523
				console.log("########data");
523 524
				//先尝试使用浏览器内部JSON解析器
524 525
				return window.JSON && window.JSON.parse ?
525 526
					window.JSON.parse( data ) :
@ -720,7 +721,9 @@ define(["zepto"],function($){
720 721
		},
721 722
		parseString:function(str){
722 723
			str=$.parseJsonString(str);
723
			(new Function("this.parseObject(" +str+")")).apply(this);
724
			console.log("#####this.parseObject");
725
			return window.JSON && window.JSON.parse ? this.parseObject(window.JSON.parse(str)) 
726
					: (new Function("this.parseObject(" +str+")")).apply(this);
724 727
			//if(typeof(o)=="object")this.parseObject(o);
725 728
		},
726 729
		parseObject:function(obj){
@ -809,7 +812,9 @@ define(["zepto"],function($){
809 812
		},	
810 813
		parseString:function(str){
811 814
			str=$.parseJsonString(str);
812
			(new Function("this.parseArray(" +str+")")).apply(this);	
815
			console.log("#####this.parseArray");
816
			return window.JSON && window.JSON.parse ? this.parseArray(window.JSON.parse(str)) : 
817
				(new Function("this.parseArray(" +str+")")).apply(this);	
813 818
		},
814 819
		parseArray:function(o){
815 820
			for(var i=0;i<o.length;i++){

+ 8 - 3
ipu-server/web/res/js/base/jcl.js

@ -519,7 +519,8 @@ define(["zepto"],function($){
519 519
			if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@")
520 520
				.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]")
521 521
				.replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) {
522

522
						
523
				console.log("########data");
523 524
				//先尝试使用浏览器内部JSON解析器
524 525
				return window.JSON && window.JSON.parse ?
525 526
					window.JSON.parse( data ) :
@ -720,7 +721,9 @@ define(["zepto"],function($){
720 721
		},
721 722
		parseString:function(str){
722 723
			str=$.parseJsonString(str);
723
			(new Function("this.parseObject(" +str+")")).apply(this);
724
			console.log("#####this.parseObject");
725
			return window.JSON && window.JSON.parse ? this.parseObject(window.JSON.parse(str)) 
726
					: (new Function("this.parseObject(" +str+")")).apply(this);
724 727
			//if(typeof(o)=="object")this.parseObject(o);
725 728
		},
726 729
		parseObject:function(obj){
@ -809,7 +812,9 @@ define(["zepto"],function($){
809 812
		},	
810 813
		parseString:function(str){
811 814
			str=$.parseJsonString(str);
812
			(new Function("this.parseArray(" +str+")")).apply(this);	
815
			console.log("#####this.parseArray");
816
			return window.JSON && window.JSON.parse ? this.parseArray(window.JSON.parse(str)) : 
817
				(new Function("this.parseArray(" +str+")")).apply(this);	
813 818
		},
814 819
		parseArray:function(o){
815 820
			for(var i=0;i<o.length;i++){