在将一个遗留 Django 项目(基于 Django 1.1)本地化为日语后,当语言环境为日语时,一些日志(不是全部)正在输出如下内容:
Traceback (most recent call last):
File "/home/deploy/.pythonbrew/pythons/Python-2.7/lib/python2.7/logging/__init__.py", line 838, in emit
msg = self.format(record)
File "/home/deploy/.pythonbrew/pythons/Python-2.7/lib/python2.7/logging/__init__.py", line 715, in format
return fmt.format(record)
File "/home/deploy/.pythonbrew/pythons/Python-2.7/lib/python2.7/logging/__init__.py", line 467, in format
s = self._fmt % record.__dict__
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)
这可能是什么原因,有没有简单的方法来规避这个问题?如果没有,我该如何更仔细地调查这个问题,因为我什至不知道哪些行调用了失败的日志?提前致谢。