V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
chendajun
V2EX  ›  Python

Python3.5 用 urllib post 方法数据,不能直接 post 中文。

  •  
  •   chendajun · 2016-06-17 11:39:10 +08:00 · 2721 次点击
    这是一个创建于 2880 天前的主题,其中的信息可能已经有所发展或是发生改变。
    4 条回复    2016-06-17 20:03:51 +08:00
    gssdromen
        1
    gssdromen  
       2016-06-17 15:54:19 +08:00
    urlencode 了么?
    chendajun
        2
    chendajun  
    OP
       2016-06-17 16:18:21 +08:00
    @gssdromen hi ,我是 Python 小白。具体流程是这样的:我这边需 post 一个 json (里面包含中文)到系统里面,如果 encode 后服务器那边接收到的就不是中文了。
    warcraft1236
        3
    warcraft1236  
       2016-06-17 17:21:14 +08:00
    @chendajun URLEncode 跟你想的应该不太一样,百度一下就知道了
    gssdromen
        4
    gssdromen  
       2016-06-17 20:03:51 +08:00
    @chendajun 不论什么文字,在传输时都是需要编码成字符和数字的,在服务器那边用对应方法变回中文就行,你没有给出源码,我也不能知道到底是什么问题~
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1768 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 16:34 · PVG 00:34 · LAX 09:34 · JFK 12:34
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.