From 0bb43c71303badd364abbf0c494a583a26f87bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=20=E5=AD=A6=E6=98=8E?= Date: Tue, 10 Sep 2013 17:12:30 +0800 Subject: [PATCH] fix issue 11 Display original utf-8 string --- src/formattedJSON.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/formattedJSON.js b/src/formattedJSON.js index bdda14e..0aa62f2 100644 --- a/src/formattedJSON.js +++ b/src/formattedJSON.js @@ -202,7 +202,8 @@ } for( var i = 0, ii = keys.length; i < ii; i++ ) { - this._append( list, this._append( this._html( "
" ), this._html( '"', document.createTextNode( keys[i] ), '"', ':' ) ) ); + var k = eval('"'+keys[i]+'"'); + this._append( list, this._append( this._html( "
" ), this._html( '"', document.createTextNode( k ), '"', ':' ) ) ); this._append( list, this._append( this._html( "
" ), this.render( obj[keys[i]] ) ) ); } @@ -229,6 +230,7 @@ * render a javascript string as JSON */ renderString: function( obj ) { + obj = eval('"'+obj+'"'); var collapsible = obj.length > parseInt( settings.long_string_length, 10 ), collapsed = collapsible && settings.fold_strings, class_names = ["string"]; @@ -241,7 +243,7 @@ this._html( collapsible ? '' : '', '"', - this._append( this._html( '' ), document.createTextNode( obj ) ), + this._append( this._html( '' ), document.createTextNode( obj )), '"', ',' )