summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>2011-06-21 04:31:36 +0000
committerlmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>2011-06-21 04:31:36 +0000
commit34d6576d80e6bc0cb36b697611c4661c09ecd0a1 (patch)
tree0f1b9cbe5174555d0710a4507caaa6295e881efa
parent3de1c1e1ac8375ab553a6cb98d22362a0c4c48ac (diff)
utils: Fix unicode conversion errors in matrix_to_string()
str() method will fail if there are non-ascii characters in the string. A "UnicodeEncodeError: 'ascii' codec can't encode characters..." error will be generated in this case. Since this method is used by the scheduler to setup emails, the scheduler can get into a nasty failure loop here. The fix is simply to encode the string as utf-8. This fixes the original issue introduced with http://autotest.kernel.org/changeset/5076 Signed-off-by: Dale Curtis <dalecurtis@google.com> git-svn-id: svn://test.kernel.org/autotest/trunk@5431 592f7852-d20e-0410-864c-8624ca9c26a4
-rw-r--r--client/common_lib/base_utils.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/client/common_lib/base_utils.py b/client/common_lib/base_utils.py
index db7b8698..ad19e80a 100644
--- a/client/common_lib/base_utils.py
+++ b/client/common_lib/base_utils.py
@@ -246,7 +246,7 @@ def matrix_to_string(matrix, header=None):
lengths.append(len(column))
for row in matrix:
for i, column in enumerate(row):
- column = str(column)
+ column = unicode(column).encode("utf-8")
cl = len(column)
try:
ml = lengths[i]