美文网首页
前后端“中文编码”问题

前后端“中文编码”问题

作者: 龙黎_ | 来源:发表于2019-01-20 23:10 被阅读13次

    前端:JQ

    // 待发字符串:str = "这是要发的字符串"
    var str_encode = encodeURI(str)   //[gbk编码]
    // str_encode = %E3%80%8C%E3%82%82%E3%81%86%E5%B0%84%E7%B2
    

    后端:Python

    from urllib.request import unquote
    // str_encode = %E3%80%8C%E3%82%82%E3%81%86%E5%B0%84%E7%B2
    str_decode = unquote(str_encode)
    // str_decode = "这是要发的字符串"
    

    相关文章

      网友评论

          本文标题:前后端“中文编码”问题

          本文链接:https://www.haomeiwen.com/subject/htzfjqtx.html