decode_json 必须是unicode形式的字符
2016-03-18 21:28
387 查看
$response->decoded_content是字符 $response->content是字节 jrhmpt01:/root# perl x3.pl 307 0 $str is %E6%9D%AD%E5%B7%9E $content is {"code":1000,"msg":"success!","data":{"buses":[{"busId":0,"station":-1,"state":-1,"distance":-1,"reporTime":-1}],"stations":[{"station":1,"stateName":"\u5218\u6587\u6751"},{"station":2,"stateName":"\u8584\u677f\u5206\u5382"},{"station":3,"stateName":"\u6bdb\u7af9\u5c71"},{"station":4,"stateName":"\u6c88\u5bb6\u6865"},{"station":5,"stateName":"\u7126\u5316\u5206\u5382"},{"station":6,"stateName":"\u676d\u73bb"},{"station":7,"stateName":"\u5f20\u5bb6\u56ed"},{"station":8,"stateName":"\u8881\u5bb6\u6751"},{"station":9,"stateName":"\u674e\u738b\u6865"},{"station":10,"stateName":"\u768b\u4ead\u575d"},{"station":11,"stateName":"\u5584\u8d24\u575d"},{"station":12,"stateName":"\u5584\u8d24\u793e\u533a"},{"station":13,"stateName":"\u6c88\u5858\u6e7e"},{"station":14,"stateName":"\u4e8c\u7eba\u673a\u603b\u5382"},{"station":15,"stateName":"\u957f\u4e50\u8def"},{"station":16,"stateName":"\u5927\u5173\u6865\u897f"},{"station":17,"stateName":"\u6559\u5de5\u8def\u5858\u6cb3\u8def\u53e3"},{"station":18,"stateName":"\u4fdd\u4ead\u5df7"},{"station":19,"stateName":"\u6d59\u6c5f\u5de5\u5546\u5927\u5b66"},{"station":20,"stateName":"\u82b1\u56ed\u65b0\u6751"},{"station":21,"stateName":"\u6559\u5de5\u8def\u82b1\u56ed\u4ead"},{"station":22,"stateName":"\u5e86\u4e30\u6751"},{"station":23,"stateName":"\u676d\u5927\u8def"},{"station":24,"stateName":"\u9ec4\u9f99\u6d1e"},{"station":25,"stateName":"\u9ec4\u9f99\u4f53\u80b2\u4e2d\u5fc3"}]}} ^C jrhmpt01:/root# vim x3.pl jrhmpt01:/root# perl x3.pl 307 0 $str is %E6%9D%AD%E5%B7%9E $content is {"code":1000,"msg":"success!","data":{"buses":[{"busId":0,"station":-1,"state":-1,"distance":-1,"reporTime":-1}],"stations":[{"station":1,"stateName":"\u5218\u6587\u6751"},{"station":2,"stateName":"\u8584\u677f\u5206\u5382"},{"station":3,"stateName":"\u6bdb\u7af9\u5c71"},{"station":4,"stateName":"\u6c88\u5bb6\u6865"},{"station":5,"stateName":"\u7126\u5316\u5206\u5382"},{"station":6,"stateName":"\u676d\u73bb"},{"station":7,"stateName":"\u5f20\u5bb6\u56ed"},{"station":8,"stateName":"\u8881\u5bb6\u6751"},{"station":9,"stateName":"\u674e\u738b\u6865"},{"station":10,"stateName":"\u768b\u4ead\u575d"},{"station":11,"stateName":"\u5584\u8d24\u575d"},{"station":12,"stateName":"\u5584\u8d24\u793e\u533a"},{"station":13,"stateName":"\u6c88\u5858\u6e7e"},{"station":14,"stateName":"\u4e8c\u7eba\u673a\u603b\u5382"},{"station":15,"stateName":"\u957f\u4e50\u8def"},{"station":16,"stateName":"\u5927\u5173\u6865\u897f"},{"station":17,"stateName":"\u6559\u5de5\u8def\u5858\u6cb3\u8def\u53e3"},{"station":18,"stateName":"\u4fdd\u4ead\u5df7"},{"station":19,"stateName":"\u6d59\u6c5f\u5de5\u5546\u5927\u5b66"},{"station":20,"stateName":"\u82b1\u56ed\u65b0\u6751"},{"station":21,"stateName":"\u6559\u5de5\u8def\u82b1\u56ed\u4ead"},{"station":22,"stateName":"\u5e86\u4e30\u6751"},{"station":23,"stateName":"\u676d\u5927\u8def"},{"station":24,"stateName":"\u9ec4\u9f99\u6d1e"},{"station":25,"stateName":"\u9ec4\u9f99\u4f53\u80b2\u4e2d\u5fc3"}]}} 字节 -> decode ->字符串 ->encode ->字节 decode_json 必须是unicode形式的字符 字符<-decode_json<-字节 字符->encode_json->字节
相关文章推荐
- decode_json 必须是unicode形式的字符
- JavaScript下拉列表的二级联动
- 如何在jsp页面中利用el表达式的<p>${error }</p>取值?
- json转bean对象
- gson处理多层嵌套的复杂形式的json
- servlet和jsp的区别
- ES6中Json的与Map之间的转换
- Markdown写接口文档,自动添加TOC
- Javascript 执行上下文 context&scope
- js原生的ajax写法
- 浅谈JSON数据解析方法
- JS中选择DOM元素的方法集锦
- HTML、CSS、JavaScript学习总结
- js 小数点后截取5位
- Extjs grid的store数据转成json数组
- JS遍历后台List数据
- 前端开发自学之JavaScript——显示当前时间
- JS正则表达式验证数字非常全
- 75、JSON 解析库---FastJson, Gson
- 学习笔记--js的date对象