use UTF8 strings to avoid EncodeErrors (bug #162493)
authorgenone <genone@gentoo.org>
Fri, 5 Oct 2007 14:07:49 +0000 (14:07 -0000)
committergenone <genone@gentoo.org>
Fri, 5 Oct 2007 14:07:49 +0000 (14:07 -0000)
svn path=/; revision=451

trunk/ChangeLog
trunk/src/glsa-check/glsa-check
trunk/src/glsa-check/glsa.py

index b38966486373e13932b60913fc745d26d0b950e3..38cb151364340ca48e5d9cf42dac102ade92f7dc 100644 (file)
@@ -1,3 +1,7 @@
+2007-10-05: Marius Mauch <genone@gentoo.org>
+       * glsa-check: Use UTF-8 strings to avoid EncodeErrors if a GLSA contains
+       non-ascii characters (bug #162493)
+
 2007-09-19: Paul Varner <fuzzyray@gentoo.org>
        * epkginfo: Fix handling of KEYWORDS="" in an ebuild. (Bug #193108)
        * revdep-rebuild: Fix handling of /var/db/pkg when it is a symbolic
index 71e7b065d39c54944b869c2ec45cd5caf3b716d3..62e44495bbbf40b65bc959d4e92579eb04b9296a 100644 (file)
@@ -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)
index 60588d02d2ba2e30cf7cd127112270d7d1c923d1..5aeb7fe5a15ac591537708d4796dda4aa24e881c 100644 (file)
@@ -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):
        """