Skip to content

Commit

Permalink
Fixed encoding discovery issue
Browse files Browse the repository at this point in the history
* utf-32 encoding css' might have been discovered as beeing as utf-16 due to the boms starting with the same values
  • Loading branch information
kux committed Feb 21, 2013
1 parent a646c9b commit a437b4a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions filertags/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ def _is_in_memory(file_):


def _get_encoding_from_bom(content):
bom_to_encoding = {
codecs.BOM_UTF8: 'utf-8-sig',
codecs.BOM_UTF16_LE: 'utf-16',
codecs.BOM_UTF16_BE: 'utf-16',
codecs.BOM_UTF32_LE: 'utf-32',
codecs.BOM_UTF32_BE: 'utf-32'
}
for bom in bom_to_encoding:
import ipdb; ipdb.set_trace()
bom_to_encoding = (
(codecs.BOM_UTF32_LE, 'utf-32'),
(codecs.BOM_UTF32_BE, 'utf-32'),
(codecs.BOM_UTF8, 'utf-8-sig'),
(codecs.BOM_UTF16_LE, 'utf-16'),
(codecs.BOM_UTF16_BE, 'utf-16'))
for bom, encoding in bom_to_encoding:
if content.startswith(bom):
return bom_to_encoding[bom]
return encoding
return None


Expand Down

0 comments on commit a437b4a

Please sign in to comment.