From 83781a59b559772b7b7d23bf5cd508a0f1915a34 Mon Sep 17 00:00:00 2001 From: Juergen Weigert Date: Tue, 29 Jun 2010 14:32:22 +0200 Subject: [PATCH] request_interactive_review() should not die with stragen unicode chars. simple workaround. --- osc/core.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/osc/core.py b/osc/core.py index 8ae08e2a..e8eb1d01 100644 --- a/osc/core.py +++ b/osc/core.py @@ -4919,7 +4919,15 @@ def request_interactive_review(apiurl, request): import tempfile, subprocess, re tmpfile = None - print request + + try: + # FIXME: print can fail with unicode chars in the string. + # Here we fix the symptoms, not the cause. + # UnicodeEncodeError: 'ascii' codec can't encode character u'\u2002' in position 309: ordinal not in range(128) + print request + except: + print request.__str__().encode('ascii', 'xmlcharrefreplace') + try: msg = '(a)ccept/(d)ecline/(r)evoke/(c)ancel > ' if request.actions[0].type == 'submit':