UnicodeDecodeError when loading job files
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Checkbox |
Fix Released
|
High
|
Daniel Manrique |
Bug Description
Recent runs of checkbox have the following error strewn through the log file:
2012-06-19 11:05:07,469 ERROR Error running event handler <string> MessageInfo.
Traceback (most recent call last):
File "/usr/lib/
results.
File "<string>", line 112, in message_file
File "/usr/lib/
elements = super(TemplateI18n, self).load_
File "/usr/lib/
for string in self._reader(file):
File "/usr/lib/
buffer_new = file.read(size)
File "/usr/lib/
return codecs.
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 253: ordinal not in range(128)
This prevents any of the jobs from being loaded and any tests being run
Related branches
- Marc Tardif (community): Approve
-
Diff: 45 lines (+5/-3)3 files modifiedcheckbox/lib/template.py (+1/-1)
debian/changelog (+3/-1)
plugins/message_info.py (+1/-1)
Changed in checkbox: | |
assignee: | nobody → Daniel Manrique (roadmr) |
status: | Triaged → In Progress |
Changed in checkbox: | |
status: | In Progress → Fix Committed |
I notice
encoding= 'ANSI_X3. 4-1968'
which is weird, because we should read the files with encoding='UTF-8' I think.
This may be happening because the locale is not set and the default charset is used, see this:
charset 'C' (canonical name: ANSI_X3.4-1968) will be used.
So one solution would be to explicitly set the encoding for when a file is read.
This is just speculation though. BTW, this has happened only on server installations which are more prone to having weird language configurations: contrast values of LANG, on desktop it's for example "en_US.UTF-8", while on server it just has "en_US".
I'll keep looking into this.