commit/galaxy-central: inithello: Fix unicode decoding error when displaying the contents of certain files. Catch any future errors.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/51d3a88f45ee/ changeset: 51d3a88f45ee user: inithello date: 2013-03-18 19:32:06 summary: Fix unicode decoding error when displaying the contents of certain files. Catch any future errors. affected #: 1 file diff -r 7a4dd13dac9be2b3c9233b7a60e61d30d283744f -r 51d3a88f45ee2e3aa89395d2df13b5452d463274 lib/tool_shed/util/shed_util_common.py --- a/lib/tool_shed/util/shed_util_common.py +++ b/lib/tool_shed/util/shed_util_common.py @@ -1059,7 +1059,12 @@ """Translates the characters in text to an html string""" if text: if to_html: - escaped_text = str( markupsafe.escape( text ) ) + try: + escaped_text = text.decode( 'utf-8' ) + escaped_text = escaped_text.encode( 'ascii', 'ignore' ) + escaped_text = str( markupsafe.escape( escaped_text ) ) + except UnicodeDecodeError, e: + escaped_text = "Error decoding string: %s" % str( e ) else: escaped_text = str( text ) translated = [] Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org