zoukankan      html  css  js  c++  java
  • decode_json 必须是unicode形式的字符

    $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":"u5218u6587u6751"},{"station":2,"stateName":"u8584u677fu5206u5382"},{"station":3,"stateName":"u6bdbu7af9u5c71"},{"station":4,"stateName":"u6c88u5bb6u6865"},{"station":5,"stateName":"u7126u5316u5206u5382"},{"station":6,"stateName":"u676du73bb"},{"station":7,"stateName":"u5f20u5bb6u56ed"},{"station":8,"stateName":"u8881u5bb6u6751"},{"station":9,"stateName":"u674eu738bu6865"},{"station":10,"stateName":"u768bu4eadu575d"},{"station":11,"stateName":"u5584u8d24u575d"},{"station":12,"stateName":"u5584u8d24u793eu533a"},{"station":13,"stateName":"u6c88u5858u6e7e"},{"station":14,"stateName":"u4e8cu7ebau673au603bu5382"},{"station":15,"stateName":"u957fu4e50u8def"},{"station":16,"stateName":"u5927u5173u6865u897f"},{"station":17,"stateName":"u6559u5de5u8defu5858u6cb3u8defu53e3"},{"station":18,"stateName":"u4fddu4eadu5df7"},{"station":19,"stateName":"u6d59u6c5fu5de5u5546u5927u5b66"},{"station":20,"stateName":"u82b1u56edu65b0u6751"},{"station":21,"stateName":"u6559u5de5u8defu82b1u56edu4ead"},{"station":22,"stateName":"u5e86u4e30u6751"},{"station":23,"stateName":"u676du5927u8def"},{"station":24,"stateName":"u9ec4u9f99u6d1e"},{"station":25,"stateName":"u9ec4u9f99u4f53u80b2u4e2du5fc3"}]}}
    
    ^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":"u5218u6587u6751"},{"station":2,"stateName":"u8584u677fu5206u5382"},{"station":3,"stateName":"u6bdbu7af9u5c71"},{"station":4,"stateName":"u6c88u5bb6u6865"},{"station":5,"stateName":"u7126u5316u5206u5382"},{"station":6,"stateName":"u676du73bb"},{"station":7,"stateName":"u5f20u5bb6u56ed"},{"station":8,"stateName":"u8881u5bb6u6751"},{"station":9,"stateName":"u674eu738bu6865"},{"station":10,"stateName":"u768bu4eadu575d"},{"station":11,"stateName":"u5584u8d24u575d"},{"station":12,"stateName":"u5584u8d24u793eu533a"},{"station":13,"stateName":"u6c88u5858u6e7e"},{"station":14,"stateName":"u4e8cu7ebau673au603bu5382"},{"station":15,"stateName":"u957fu4e50u8def"},{"station":16,"stateName":"u5927u5173u6865u897f"},{"station":17,"stateName":"u6559u5de5u8defu5858u6cb3u8defu53e3"},{"station":18,"stateName":"u4fddu4eadu5df7"},{"station":19,"stateName":"u6d59u6c5fu5de5u5546u5927u5b66"},{"station":20,"stateName":"u82b1u56edu65b0u6751"},{"station":21,"stateName":"u6559u5de5u8defu82b1u56edu4ead"},{"station":22,"stateName":"u5e86u4e30u6751"},{"station":23,"stateName":"u676du5927u8def"},{"station":24,"stateName":"u9ec4u9f99u6d1e"},{"station":25,"stateName":"u9ec4u9f99u4f53u80b2u4e2du5fc3"}]}}
    
    
    字节 -> decode ->字符串 ->encode ->字节
    
    
    decode_json 必须是unicode形式的字符
    
    
    字符<-decode_json<-字节
    字符->encode_json->字节

  • 相关阅读:
    把J2ME JAVA 手機軟體轉成EXE檔的工具 [小糊涂的灵感]
    java game 小尺寸设计 [小糊涂的灵感]
    手机游戏开发综述(转载)[小糊涂的灵感]
    (Nokia开发包安装的过程)[小糊涂的灵感]
    Bobber Tec授权3D游戏开发引擎了。[小糊涂的灵感]
    Game features List Template:[小糊涂的灵感]
    GameCanvas快速开发吧.[小糊涂的灵感]
    手机flash技术的初步介绍,(上次飞思的来北京聊了一下)[小糊涂的灵感]
    五子棋判断输赢的算法描述.[小糊涂的灵感]
    NRF51822之GPIOTE使用
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350939.html
Copyright © 2011-2022 走看看