From 5c49182a4ba6fe4c9f4cef5ad3aaf7335b2d2a47 Mon Sep 17 00:00:00 2001
From: Ben Adida <ben@adida.net>
Date: Sat, 4 Jun 2011 21:23:35 -0700
Subject: [PATCH] more error resilient for voter_id encoding

---
 helios/models.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/helios/models.py b/helios/models.py
index 7e8f166..6e3f7d7 100644
--- a/helios/models.py
+++ b/helios/models.py
@@ -827,7 +827,10 @@ class Voter(HeliosModel):
     try:
       return utils.hash_b64(value_to_hash)
     except:
-      return utils.hash_b64(value_to_hash.encode('latin-1'))
+      try:
+        return utils.hash_b64(value_to_hash.encode('latin-1'))
+      except:
+        return utils.hash_b64(value_to_hash.encode('utf-8'))        
 
   @property
   def voter_type(self):
-- 
GitLab