diff -r b65577e5c8c6 -r ea909da895ab Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py --- a/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py Thu Jul 31 16:37:52 2014 +0200 +++ b/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py Thu Jul 31 16:53:43 2014 +0200 @@ -104,14 +104,6 @@ hangClosing, docType, errors, eol, encoding, backup = args stats = {} - # avoid 'Encoding declaration in unicode string' exception on Python2 - if sys.version_info[0] == 2: - if encoding == 'utf-8-bom': - enc = 'utf-8' - else: - enc = encoding - source = [line.encode(enc) for line in source] - # Don't check an empty file if source == []: return stats, [] @@ -125,6 +117,14 @@ fixer = None if not errors: + # avoid 'Encoding declaration in unicode string' exception on Python2 + if sys.version_info[0] == 2: + if encoding == 'utf-8-bom': + enc = 'utf-8' + else: + enc = encoding + source = [line.encode(enc) for line in source] + if includeMessages: select = [s.strip() for s in includeMessages.split(',') if s.strip()]