用Djang在Python/RML中编码

2024-05-16 18:58:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用ReportLab和RML创建发票。 在我的测试系统中,德语元音变音没有问题,比如ßin Straße

但是在生产系统上它给了我:

UnicodeDecodeError at /abrechnung/abrechnung/angebot/2/print/

'ascii' codec can't decode byte 0xc3 in position 513: ordinal not in range(128)

Request Method:     GET
Request URL:    http://eu-con-app.de/webapps/gerloff/abrechnung/abrechnung/angebot/2/print/
Django Version:     1.8.4
Exception Type:     UnicodeDecodeError
Exception Value:    

'ascii' codec can't decode byte 0xc3 in position 513: ordinal not in range(128)

Exception Location:     /webapps/gerloff/lib/python3.4/encodings/ascii.py in decode, line 26
Python Executable:  /webapps/gerloff/bin/python3.4
Python Version:     3.4.3
Python Path:    

['/webapps/gerloff/gerloff_ltw',
 '/webapps/gerloff/bin',
 '/webapps/gerloff/gerloff_ltw',
 '/webapps/gerloff/lib/python3.4',
 '/webapps/gerloff/lib/python3.4/plat-x86_64-linux-gnu',
 '/webapps/gerloff/lib/python3.4/lib-dynload',
 '/usr/lib/python3.4',
 '/usr/lib/python3.4/plat-x86_64-linux-gnu',
 '/webapps/gerloff/lib/python3.4/site-packages']

而试验机不会产生误差。在

我用相似的设置测试了这两种代码,主要不同的是,生产代码由gunicorn运行,测试代码由djangostestserver交付。在


Tags: inlib系统asciiexceptionbytecancodec