diff options
author | chenguodong <chenguodong@huawei.com> | 2011-08-22 18:42:47 +0800 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2011-11-29 12:11:41 -0800 |
commit | 605a9a487bba6e25fb48d4e3076c89b7f686517a (patch) | |
tree | 0c0bf5133e24f319a1d6c61d8237b87469c202b7 | |
parent | 2a32f6afa64c88142a476cd719d29cebacbdfd19 (diff) | |
download | git-repo-605a9a487bba6e25fb48d4e3076c89b7f686517a.tar.gz |
Fixed UnicodeDecodeError while uploading changes.
When commit with comment that has non-ASCII characters,
UnicodeDecodeError will be raised
while uploading multiple project/branch changes.
Because some strings in script are not str type, but unicode.
So all the strings are decoded to unicode,
and python use ascii to do this,
it can not decode non-ASCII characters,
so UnicodeDecodeError raised.
Signed-off-by: chenguodong <chenguodong@huawei.com>
Change-Id: I46447f489a4b9760a5899c7ba9d764b688594e46
-rw-r--r-- | subcmds/upload.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/subcmds/upload.py b/subcmds/upload.py index c1958373..a08926c6 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
@@ -215,6 +215,11 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
215 | branches[project.name] = b | 215 | branches[project.name] = b |
216 | script.append('') | 216 | script.append('') |
217 | 217 | ||
218 | script = [ x.encode('utf-8') | ||
219 | if issubclass(type(x), unicode) | ||
220 | else x | ||
221 | for x in script ] | ||
222 | |||
218 | script = Editor.EditString("\n".join(script)).split("\n") | 223 | script = Editor.EditString("\n".join(script)).split("\n") |
219 | 224 | ||
220 | project_re = re.compile(r'^#?\s*project\s*([^\s]+)/:$') | 225 | project_re = re.compile(r'^#?\s*project\s*([^\s]+)/:$') |