Index: presubmit_support.py |
diff --git a/presubmit_support.py b/presubmit_support.py |
index f1f70d9c4e7e832f3ab84e2ea2d4eca69994424e..e9a2dbd49763f25d93ec7ebbc325446b7d31f13f 100755 |
--- a/presubmit_support.py |
+++ b/presubmit_support.py |
@@ -50,6 +50,7 @@ except ImportError: |
import simplejson as json # pylint: disable=F0401 |
# Local imports. |
+import fix_encoding |
import gclient_utils |
import owners |
import presubmit_canned_checks |
@@ -142,18 +143,18 @@ class OutputApi(object): |
def handle(self, output): |
output.write(self._message) |
output.write('\n') |
- if len(self._items) > 0: |
- output.write(' ' + ' \\\n '.join(map(str, self._items)) + '\n') |
+ for index, item in enumerate(self._items): |
+ output.write(' ') |
+ # Write separately in case it's unicode. |
+ output.write(item) |
+ if index < len(self._items) - 1: |
+ output.write(' \\') |
+ output.write('\n') |
if self._long_text: |
- # Sometimes self._long_text is a ascii string, a codepage string |
- # (on windows), or a unicode object. |
- try: |
- long_text = self._long_text.decode() |
- except UnicodeDecodeError: |
- long_text = self._long_text.decode('ascii', 'replace') |
- |
- output.write('\n***************\n%s\n***************\n' % |
- long_text) |
+ output.write('\n***************\n') |
+ # Write separately in case it's unicode. |
+ output.write(self._long_text) |
+ output.write('\n***************\n') |
if self.fatal: |
output.fail() |
@@ -1192,4 +1193,5 @@ def Main(argv): |
if __name__ == '__main__': |
+ fix_encoding.fix_encoding() |
sys.exit(Main(None)) |