Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Unified Diff: presubmit_support.py

Issue 6721029: Fix locale.getlocale() exception. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient.py ('k') | tests/fix_encoding_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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))
« no previous file with comments | « gclient.py ('k') | tests/fix_encoding_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698