Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#20354 closed Bug (fixed)

`makemessages` crashes when reading non-UTF8 encoded files.

Reported by: Tai Lee Owned by: nobody
Component: Core (Management commands) Version: dev
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have a project with a 3rd party bundled file (MIT-license.txt) which is apparently not encoded with UTF-8 and contains some characters that makes the makemessages management command crash with a UnicodeDecodeError. It outputs the full contents of the file, but not the file name or location. Not very helpful.

I don't really want to have to search my project for 3rd party non-UTF8 files with a .txt or .html extension and convert them to UTF8. I'd rather leave 3rd party files as they are so I can diff and update them easier.

I also don't really want to do a find across the whole project looking for a match against the content that caused the error, so I can work out the filename and explicitly ignore it with a glob pattern.

I'd like Django to simply warn me that the file generated a UnicodeDecodeError and was skipped, then continue processing other files. If it's important, then I can go and fix it.

Change History (4)

comment:1 by Tai Lee, 11 years ago

Has patch: set

comment:2 by Claude Paroz, 11 years ago

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

It might be a regression in 1.5.

comment:3 by Claude Paroz <claude@…>, 11 years ago

Resolution: fixed
Status: newclosed

In 99a6f0e77c6e02b310687667d41df56c17b953bf:

Fixed #20354 -- makemessages no longer crashes with UnicodeDecodeError

Handle the UnicodeDecodeError exception, send a warning to stdout with the
file name and location, and continue processing other files.

comment:4 by Claude Paroz <claude@…>, 11 years ago

In 23b234a9d9ea26acb9bb12ba14231ce8844d2e53:

[1.5.x] Fixed #20354 -- makemessages no longer crashes with UnicodeDecodeError

Handle the UnicodeDecodeError exception, send a warning to stdout with the
file name and location, and continue processing other files.
Backport of 99a6f0e77 from master.

Note: See TracTickets for help on using tickets.
Back to Top