diff options
| author | Justin Bronn <jbronn@gmail.com> | 2007-10-26 20:47:20 +0000 |
|---|---|---|
| committer | Justin Bronn <jbronn@gmail.com> | 2007-10-26 20:47:20 +0000 |
| commit | 4ffbddf92d89c3b31cef90043721184a501cd454 (patch) | |
| tree | db8131d40b0a5437270a6b1e8d579113ab3508e8 /django/views/debug.py | |
| parent | f66ee9d0065838a0f6c9c76203a775a78446cdf7 (diff) | |
gis: Merged revisions 6525-6613 via svnmerge from [repos:django/trunk trunk].
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@6615 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/views/debug.py')
| -rw-r--r-- | django/views/debug.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/django/views/debug.py b/django/views/debug.py index cf0b6b5a0b..717de1eb34 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -201,16 +201,15 @@ def _get_lines_from_file(filename, lineno, context_lines, loader=None, module_na if source is None: return None, [], None, [] - encoding=None + encoding = 'ascii' for line in source[:2]: - # File coding may be specified (and may not be UTF-8). Match - # pattern from PEP-263 (http://www.python.org/dev/peps/pep-0263/) + # File coding may be specified. Match pattern from PEP-263 + # (http://www.python.org/dev/peps/pep-0263/) match = re.search(r'coding[:=]\s*([-\w.]+)', line) if match: encoding = match.group(1) break - if encoding: - source = [unicode(sline, encoding) for sline in source] + source = [unicode(sline, encoding, 'replace') for sline in source] lower_bound = max(0, lineno - context_lines) upper_bound = lineno + context_lines |
