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

Michał Pasternak michal.dtz at gmail.com
Sat Jul 4 03:31:27 EDT 2009

I think it is a bug, I think I also ran into it some time ago. Could you please file a bug report at http://www.divmod.org/ ?


-----Original Message-----
From: twisted-web-bounces at twistedmatrix.com [mailto:twisted-web-bounces at twistedmatrix.com] On Behalf Of Paul Reznicek
Sent: Thursday, July 02, 2009 12:37 PM
To: Twisted-web at twistedmatrix.com
Subject: [Twisted-web] Athena Unicode problem with LatinX messages from browser

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

Twisted-web mailing list
Twisted-web at twistedmatrix.com

More information about the Twisted-web mailing list