Commit 310b3555 authored by maruel@chromium.org's avatar maruel@chromium.org

Fix decoding to work more often with various encodings found on platforms.

TEST=none
BUG=none

Review URL: http://codereview.chromium.org/4108011

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@64598 0039d316-1c4b-4281-b951-d872f2087c98
parent 406a6cad
......@@ -114,8 +114,15 @@ class OutputApi(object):
if len(self._items) > 0:
output_stream.write(' ' + ' \\\n '.join(map(str, self._items)) + '\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_stream.write('\n***************\n%s\n***************\n' %
self._long_text.encode('ascii', 'replace'))
long_text)
if self.ShouldPrompt() and may_prompt:
if not PromptYesNo(input_stream, output_stream,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment