From bd1211647742e88b98cf89206428eec293c911eb Mon Sep 17 00:00:00 2001 From: Erik Osheim Date: Sat, 27 Mar 2010 23:06:12 -0400 Subject: [PATCH] fix issue with no known encoding --HG-- branch : pmacs2 --- buffer/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/buffer/__init__.py b/buffer/__init__.py index 5189e22..f00cc58 100644 --- a/buffer/__init__.py +++ b/buffer/__init__.py @@ -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'