Martin Sivak has uploaded a new change for review. Change subject: Fix the charset conversion logic in hooks.py ......................................................................
Fix the charset conversion logic in hooks.py The proper way to convert text from byte oriented string to unicode is to call str.decode(encoding). This patch fixes this and makes Jenkins tests work for people with diacritics in their names. Change-Id: I9063291f8a4a392b2913220fe2839386dcffd825 Signed-off-by: Martin Sivak <[email protected]> --- M vdsm/hooks.py 1 file changed, 7 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/56/15856/1 diff --git a/vdsm/hooks.py b/vdsm/hooks.py index ddb230a..cfcca52 100644 --- a/vdsm/hooks.py +++ b/vdsm/hooks.py @@ -22,6 +22,7 @@ from vdsm import utils import glob import os +import sys import tempfile import logging @@ -66,8 +67,13 @@ ppath = scriptenv.get('PYTHONPATH', '') scriptenv['PYTHONPATH'] = ':'.join(ppath.split(':') + [P_VDSM]) scriptenv['_hook_domxml'] = xmlname + + # Encode the values to UTF-8 + # We have to decode them first, because os.environ contains + # everything in the byte-string form and it will blow up on ascii + # codec error without it for k, v in scriptenv.iteritems(): - scriptenv[k] = unicode(v).encode('utf-8') + scriptenv[k] = v.decode(sys.stdin.encoding).encode('utf-8') errorSeen = False for s in scripts: -- To view, visit http://gerrit.ovirt.org/15856 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9063291f8a4a392b2913220fe2839386dcffd825 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Martin Sivak <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
