fix of a minor bug reported by syssecurity7@googlemail.com (missing iso-8858...)

This commit is contained in:
Miroslav Stampar 2011-03-21 16:43:46 +00:00
parent 0d3f6edcc4
commit cbfb10cbd1
2 changed files with 6 additions and 0 deletions

View File

@ -500,6 +500,9 @@ Stuffe <stuffe.dk@gmail.com>
Sylphid <sylphid.su@sti.com.tw> Sylphid <sylphid.su@sti.com.tw>
for suggesting some features for suggesting some features
syssecurity.info <syssecurity7@googlemail.com>
for reporting a minor bug
ToR <sstidus@email.it> ToR <sstidus@email.it>
for reporting considerable amount of bugs for reporting considerable amount of bugs
for suggesting a feature for suggesting a feature

View File

@ -103,6 +103,8 @@ def checkCharEncoding(encoding):
# http://philip.html5.org/data/charsets-2.html # http://philip.html5.org/data/charsets-2.html
if encoding in translate: if encoding in translate:
encoding = translate[encoding] encoding = translate[encoding]
elif encoding.startswith('iso-8858'): #very popular typo
encoding = encoding.replace('8858', '8859')
elif encoding.startswith('cp-'): elif encoding.startswith('cp-'):
encoding = 'cp%s' % encoding[3:] encoding = 'cp%s' % encoding[3:]
elif encoding.startswith('windows') and not encoding.startswith('windows-'): elif encoding.startswith('windows') and not encoding.startswith('windows-'):
@ -110,6 +112,7 @@ def checkCharEncoding(encoding):
elif encoding == 'null': elif encoding == 'null':
return None return None
# http://www.iana.org/assignments/character-sets
try: try:
codecs.lookup(encoding) codecs.lookup(encoding)
except LookupError: except LookupError: