Giter Site home page Giter Site logo

debian 8 LANG为zh_CN.UTF-8,safeUnicode报错:UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 2: ordinal not in range(128) about vnpy HOT 3 CLOSED

vnpy avatar vnpy commented on May 27, 2024
debian 8 LANG为zh_CN.UTF-8,safeUnicode报错:UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 2: ordinal not in range(128)

from vnpy.

Comments (3)

 avatar commented on May 27, 2024 1

linux我这里是没有问题的。不过要改一些地方。

比如vtfunction里面加
reload(sys) sys.setdefaultencoding('utf8')

from vnpy.

lhzw avatar lhzw commented on May 27, 2024

因为zh_CN.UTF-8作为默认语言时,获取到的时间串是这样的,"23时15分30秒",就是utf8编码的了,我还没有找这个时间是在什么地方生成的。然后python的默认编码又是ascii码,解码不了,就报上面的错了:
n [16]: sys.getdefaultencoding()
Out[16]: 'ascii'

暂时解决办法,把这些字符串使用utf8进行decode()即可。
返回时间处,直接返回形如23:12:20就可以避免这样的问题了。但是safeUnicode()实际上也并不是很安全啊。

from vnpy.

vnpy avatar vnpy commented on May 27, 2024

主要因为vn.trader目前还只是在windows上开发,linux的移植工作2016年下半年会展开。

from vnpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.