[Twisted-web] Athena Unicode problem with LatinX messages from browser

Paul Reznicek maillists at ivsn.com
Thu Jul 2 06:36:56 EDT 2009

This is only for information if somebody get same problem how to make
non-ascii JS error visible.

I found per coincidence a weakness in athena message handling.
This happen, when browser report JS error with non-ascii characters:
   # ---------------------------
   Traceback (most recent call last):
   Failure: nevow.athena.JSException:
   <JSException instance at 52468224 with str error Traceback (most recent call last):

   File "/usr/lib/python2.6/dist-packages/twisted/python/reflect.py", line 561, in safe_str
     return str(o)

   UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 12:
     ordinal not in range(128)
   # ---------------------------
and you do NOT see the error message from browser to fix the problem.

In my case, the message from browser was: "Chybná hodnota vlastnosti."

To see, what is going on i added to my errBackPrintError function:
     print '%r' % error
and get now:
     ... JSException(u'Error: Chybn\xe1 hodnota vlastnosti.',)
so I can see, what is going on.

Regards, Paul

More information about the Twisted-web mailing list