推荐学习书目
› 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
honmaple
V2EX  ›  Python

socketio 无法发送中文

  •  
  •   honmaple · Jul 1, 2016 · 2685 views
    This topic created in 3745 days ago, the information mentioned may be changed or developed.

    使用 flask-socketio 写了一个网页在线聊天,chat
    本地上是可以发送中文的,但是部署到服务器上就无法发送中文,这是什么原因?

    代码在这

    部署采用的是 gunicorn + supervisor + nginx

    请教这个该如何处理?

    3 replies  •  2016-07-03 02:43:01 +08:00
    guokeke
        1
    guokeke  
       Jul 2, 2016
    简单一点可以这么干:在发送之前把信息都 base64 编码再发送,接到的信息解码再显示。

    我找到些我觉得有用的东西
    https://www.base64decode.org/
    https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
    ryd994
        2
    ryd994  
       Jul 3, 2016 via Android
    多半是编码问题
    很多服务器上默认 LANG 是 C 或者 en_US
    你可以试试用 Python3 或者设置好 LANG
    fy
        3
    fy  
       Jul 3, 2016
    去年用的时候 socketio 的支持很差,与 nodejs 版的版本号有点远,于是一只用 sockjs 至今。

    楼主你这个是要看 log 的呀
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   784 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 21:10 · PVG 05:10 · LAX 14:10 · JFK 17:10
    ♥ Do have faith in what you're doing.