cnbeining / onedrivecmd

A command line client for Onedrive.
https://www.cnbeining.com/
GNU Affero General Public License v3.0
378 stars 78 forks source link

貌似编码一直没搞好 (求个临时解决也好啊) #13

Closed cm198 closed 7 years ago

cm198 commented 7 years ago

系统是ubuntu 16.04 上传正常 onedrivecmd list od:/

Traceback (most recent call last): File "/usr/local/bin/onedrivecmd", line 11, in sys.exit(main()) File "/usr/local/lib/python2.7/dist-packages/onedrivecmd/onedrivecmd.py", line 64, in main do_list(client, args) File "/usr/local/lib/python2.7/dist-packages/onedrivecmd/utils/actions.py", line 331, in do_list created_date_time = created_date_time)) UnicodeEncodeError: 'ascii' codec can't encode characters in position 4-5: ordinal not in range(128)

cnbeining commented 7 years ago

我很想知道你的created_date_time里面是啥 为啥不是文件名而是时间出问题。。

Anyway,试着先在Shell里跑一句

PYTHONENCODING=utf-8 ?

cm198 commented 7 years ago

created_date_time 我木知道啊。。这个是直接pip 安装onedrivecmd的 anyway是什么 怎么跑

cnbeining commented 7 years ago

你先运行一下

PYTHONENCODING=utf-8 看看是不是encoding不对?

cm198 commented 7 years ago

PYTHONENCODING=utf-8 无输出 本机好像没设utf-8

cnbeining commented 7 years ago

然后再list一下试试?

cm198 commented 7 years ago

我用国内的服务器测试了正常 感觉是服务器系统编码没写的问题 root@ubuntu:~# onedrivecmd list od:/ od:/附件/ 0 2017-10-03T16:08:36.000000Z od:/test.html 6 2017-10-03T16:10:31.000000Z

感谢回答 这个项目非常不错

cnbeining commented 7 years ago

跑一句:

export LC_ALL="en_US.UTF-8"

把服务器设成UTF-8.

cm198 commented 7 years ago

因为我用的是docker的镜相 哪天我重新弄个 现在问题以经找到了就好解决了 就是系统编码的问题 国内速度那是一坑逼 谢谢了

cnbeining commented 7 years ago

在Dockerfile里写一句RUN 就行。

cm198 commented 7 years ago

Ensure UTF-8 locale

COPY locale /etc/default/locale

RUN locale-gen zh_CN.UTF-8 &&\ DEBIAN_FRONTEND=noninteractive dpkg-reconfigure locales RUN locale-gen zh_CN.UTF-8
ENV LANG zh_CN.UTF-8
ENV LANGUAGE zh_CN:zh
ENV LC_ALL zh_CN.UTF-8 EXPOSE 22 CMD ["/usr/sbin/sshd", "-D"]

是不起作用的构建没出错 这个都是小问题 找个国内的镜相去 这问题以经解决了

cnbeining commented 7 years ago

Thx for your effort.