From 1f790c7678adbe6e00d73ba3dfe81ca1de5cc342 Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Fri, 13 Jun 2014 12:23:53 +0300 Subject: [PATCH] create_sr: Fix unicode issue When the submitter has non ascii characters in the name, repa accept fails to create SR with the following error: $ repa accept submit/tizen_common/20140610.120852 submission submit/tizen_common/20140610.120852 Traceback (most recent call last): File "/usr/bin/repa", line 9, in load_entry_point('repa==0.2', 'console_scripts', 'repa')() File "repa/main.py", line 130, in main return args.func(args) File "repa/accept.py", line 57, in run argv.project, argv.comment) File "repa/common.py", line 104, in accept_or_reject str(meta['obs_target_prj']), message=message) File "repa/obs.py", line 174, in create_sr cgi.escape(str(message)) UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 13: ordinal not in range(128) In the above example, my name is "St\xe9phane Desneux" and \xe9 is 'e' with acute in iso-8859-15 . Fixes: #1979 Fixes: #TINF-618 Change-Id: Ied208005d2cb1e4ad0bd785418aa3bfe77d70bc0 Signed-off-by: Ed Bartosh --- repa/obs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repa/obs.py b/repa/obs.py index de055a1..3c5cdc2 100644 --- a/repa/obs.py +++ b/repa/obs.py @@ -173,7 +173,7 @@ class OBS(OSC): """Create submit request for the project.""" content = '%s' % \ - cgi.escape(str(message)) + cgi.escape(message.encode('utf-8')) for package in packages: content += '' content += '' % \ -- 2.34.1