From 1fc02c18870ad3b1944586594f6bdc113712b378 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 11 Aug 2011 13:32:20 +0530 Subject: [PATCH] fix for unicode, ask to use utf-8 encoding --- cgi-bin/webnotes/utils/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cgi-bin/webnotes/utils/__init__.py b/cgi-bin/webnotes/utils/__init__.py index 1f3e661515..f8156046c2 100644 --- a/cgi-bin/webnotes/utils/__init__.py +++ b/cgi-bin/webnotes/utils/__init__.py @@ -295,7 +295,10 @@ def cstr(s): s = s.encode('utf-8', 'ignore') except: pass - return unicode(s, 'utf-8') + try: + return unicode(s) + except UnicodeDecodeError: + return unicode(s, 'utf-8') def str_esc_quote(s): """