mitsuhiko/werkzeug — pull request #474 by onysos (2013-12-17 16:54:45+00:00)
Title: fixed charset detection with wrong regexp.

I asume that you try to find the standard «# -*- coding: utf-8 -*-» expression at the start of the readed file, but you simply use the wrong regexp since you happily re-search with _line_re instead of _coding_re.

with django, I have a file that start with «try:» and it don't break at

try:
codecs.lookup(charset)
except LookupError:
charset = 'utf-8'

. so the declared charset become «try:»...