Fix UnicodeEncodeError in vardbapi._owners_cache._hash_str(), reported by
authorZac Medico <zmedico@gentoo.org>
Wed, 5 Aug 2009 18:46:46 +0000 (18:46 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 5 Aug 2009 18:46:46 +0000 (18:46 -0000)
jlec on irc.

svn path=/main/trunk/; revision=13924

pym/portage/dbapi/vartree.py

index 075f38b2bd23f584e5a865b3617df1910dbc4c8c..b9dba438bfc921dd15e2114869782615d27687d6 100644 (file)
@@ -1425,7 +1425,7 @@ class vardbapi(dbapi):
                        h = self._new_hash()
                        # Always use a constant utf_8 encoding here, since
                        # the "default" encoding can change.
-                       h.update(s)
+                       h.update(s.encode('utf_8', 'replace'))
                        h = h.hexdigest()
                        h = h[-self._hex_chars:]
                        h = int(h, 16)