1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Specified when open should use binary mode.

Thanks Vinaj Sajip for the help of his django3 branch.
This commit is contained in:
Claude Paroz
2012-05-25 20:37:38 +02:00
parent e73838b6dd
commit edfa95c22f
6 changed files with 22 additions and 20 deletions

View File

@@ -5,7 +5,7 @@ from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
def has_bom(fn):
with open(fn, 'r') as f:
with open(fn, 'rb') as f:
sample = f.read(4)
return sample[:3] == '\xef\xbb\xbf' or \
sample.startswith(codecs.BOM_UTF16_LE) or \