On Tue, 2011-10-25 at 22:31 +0200, Christoph Zwerschke wrote: > My solution was to wrap exceptions and tracebacks in text_() calls, e.g. > in render_summary, render_full and generate_plaintext_traceback. > > This avoids the crashes, but utf-8 messages will look odd because > text_() assumes latin-1 encoding by default. My suggestion is to replace > the latin-1 default with utf-8 and fall back to latin-1 only in case the > text is not decodable as utf-8. Like this: > > def text_(s, encoding=None, errors='strict'): > if isinstance(s, binary_type): > if not encoding: > try: > return s.decode('utf-8') > except UnicodeDecodeError: > encoding = 'latin-1' > return s.decode(encoding, errors) > return s # pragma: no cover > > This has been working nicely for me. Thougts? > > If you think that makes sense, I can submit a patch on github.
It's hard to tell if what you described is OK without seeing that code in context; would you mind submitting a pull request with your suggested fix? - C -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to pylons-devel@googlegroups.com. To unsubscribe from this group, send email to pylons-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en.