ENH: Clearer warning with lines which failed to decode correctly

pull/723/head
Steven Hiscocks 2014-05-15 22:48:03 +01:00
parent fc4b69a282
commit 0ca97431a0
1 changed files with 4 additions and 2 deletions

View File

@ -790,8 +790,10 @@ class FileContainer:
try:
line = line.decode(self.getEncoding(), 'strict')
except UnicodeDecodeError:
logSys.warning("Error decoding line from '%s' with '%s': %s" %
(self.getFileName(), self.getEncoding(), `line`))
logSys.warning(
"Error decoding line from '%s' with '%s'. Continuing "
" to process line ignoring invalid characters: %r" %
(self.getFileName(), self.getEncoding(), line))
if sys.version_info >= (3,): # In python3, must be decoded
line = line.decode(self.getEncoding(), 'ignore')
return line