From 417eeb43e5c95c60331e3ef111d6808ce0cba8e5 Mon Sep 17 00:00:00 2001 From: genone Date: Fri, 5 Oct 2007 14:07:49 +0000 Subject: [PATCH] use UTF8 strings to avoid EncodeErrors (bug #162493) svn path=/; revision=451 --- trunk/ChangeLog | 4 ++++ trunk/src/glsa-check/glsa-check | 3 ++- trunk/src/glsa-check/glsa.py | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/trunk/ChangeLog b/trunk/ChangeLog index b389664..38cb151 100644 --- a/trunk/ChangeLog +++ b/trunk/ChangeLog @@ -1,3 +1,7 @@ +2007-10-05: Marius Mauch + * glsa-check: Use UTF-8 strings to avoid EncodeErrors if a GLSA contains + non-ascii characters (bug #162493) + 2007-09-19: Paul Varner * epkginfo: Fix handling of KEYWORDS="" in an ebuild. (Bug #193108) * revdep-rebuild: Fix handling of /var/db/pkg when it is a symbolic diff --git a/trunk/src/glsa-check/glsa-check b/trunk/src/glsa-check/glsa-check index 71e7b06..62e4449 100644 --- a/trunk/src/glsa-check/glsa-check +++ b/trunk/src/glsa-check/glsa-check @@ -308,6 +308,7 @@ if mode == "test": if mode == "mail": import portage_mail, socket from StringIO import StringIO + from email.mime.text import MIMEText # color doesn't make any sense for mail nocolor() @@ -342,7 +343,7 @@ if mode == "mail": continue myfd = StringIO() myglsa.dump(outstream=myfd) - myattachments.append(str(myfd.getvalue())) + myattachments.append(MIMEText(str(myfd.getvalue()), _charset="utf8")) myfd.close() mymessage = portage_mail.create_message(myfrom, myrecipient, mysubject, summary, myattachments) diff --git a/trunk/src/glsa-check/glsa.py b/trunk/src/glsa-check/glsa.py index 60588d0..5aeb7fe 100644 --- a/trunk/src/glsa-check/glsa.py +++ b/trunk/src/glsa-check/glsa.py @@ -237,7 +237,8 @@ def getText(node, format): if format == "strip": rValue = rValue.strip(" \n\t") rValue = re.sub("[\s]{2,}", " ", rValue) - return str(rValue) + # Hope that the utf conversion doesn't break anything else + return rValue.encode("utf_8") def getMultiTagsText(rootnode, tagname, format): """ -- 2.26.2