##// END OF EJS Templates
fixes safe_str method...
marcink -
r1494:8e76649f beta
parent child Browse files
Show More
@@ -177,7 +177,7 b" def safe_unicode(str_, from_encoding='ut"
177 except UnicodeDecodeError:
177 except UnicodeDecodeError:
178 pass
178 pass
179
179
180 try:
180 try:
181 import chardet
181 import chardet
182 encoding = chardet.detect(str_)['encoding']
182 encoding = chardet.detect(str_)['encoding']
183 if encoding is None:
183 if encoding is None:
@@ -203,7 +203,7 b" def safe_str(unicode_, to_encoding='utf8"
203 return unicode_
203 return unicode_
204
204
205 try:
205 try:
206 return str(unicode_)
206 return unicode_.encode(to_encoding)
207 except UnicodeEncodeError:
207 except UnicodeEncodeError:
208 pass
208 pass
209
209
General Comments 0
You need to be logged in to leave comments. Login now