fix issue with no known encoding

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2010-03-27 23:06:12 -04:00
parent 9abe5e7e02
commit bd12116477
1 changed files with 2 additions and 1 deletions

View File

@ -640,7 +640,8 @@ class FileBuffer(Buffer):
f.close()
self.store_checksum(data)
data = self.read_filter(data)
self.codec = chardet.detect(data)['encoding'].lower()
codec = chardet.detect(data)['encoding'] or 'utf-8'
self.codec = codec.lower()
else:
data = ''
self.codec = 'utf-8'