From 517b9c891d0491e70fd316765a9276d24d753850 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Thu, 19 May 2011 08:24:52 +0000
Subject: [PATCH] Do not raise when encountering non-UTF-8 chars.

Instead, replace them with standard unicode "rempalcement char":
http://en.wikipedia.org/wiki/Replacement_character#Replacement_character
---
 product/ERP5Form/ListBox.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/product/ERP5Form/ListBox.py b/product/ERP5Form/ListBox.py
index db231e230d..fff29e8883 100644
--- a/product/ERP5Form/ListBox.py
+++ b/product/ERP5Form/ListBox.py
@@ -1732,7 +1732,7 @@ class ListBoxRenderer:
         processed_value = editable_field.render_view(value=original_value)
 
       if not isinstance(processed_value, unicode):
-        processed_value = unicode(str(processed_value), self.getEncoding())
+        processed_value = unicode(str(processed_value), self.getEncoding(), 'replace')
 
       value_list.append((original_value, processed_value))
 
@@ -2323,7 +2323,7 @@ class ListBoxRendererLine:
       if processed_value is None:
         processed_value = u''
       elif not isinstance(processed_value, unicode):
-        processed_value = unicode(str(processed_value), renderer.getEncoding())
+        processed_value = unicode(str(processed_value), renderer.getEncoding(), 'replace')
 
       value_list.append((original_value, processed_value))
 
-- 
2.30.9