先将string编码编码
var str = encodeURI("美丽新世界"); //str ==='%E7%BE%8E%E4%B8%BD%E6%96%B0%E4%B8%96%E7%95%8C'
而后解码code
console.log(decodeURI(str)); //'美丽新世界'