uWSGI的编码问题解决方法
报错:UnicodeEncodeError: ‘ascii' codec can't encode characters in position 24-25: ordinal not in range(128)
1、使用locale查看服务器的编码
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
2、查看系统支持的字符
locale -a
显示:
C
C.UTF-8
POSIX
3、修改/etc/profile
echo export LANG="C.UTF-8" >> /etc/profile
source /etc/profile