On Apr 25, 2005, at 9:23 PM, Rene Dudfield wrote:

repr works quite well, and I've used it with lots of different

_javascript_... However I'm not completely confident in it as it fails

for unicode.


Ah, unicode, yes. Nevow handles unicode at a different abstraction level, in the main flatten loop, nevow.flat.ten.iterflatten. It encodes to utf-8 by default.

Nevow's flattening process does a very good job of ensuring the right quoting takes place in the right context. With a little bit of tweaking, perhaps this core conversion from python data structures to correctly encoded bytes for transmission over the wire could be broken out from Nevow so other projects could benefit from it.

Quoting is so difficult to get right that if many people reimplement quoting, some of the implementations are sure to be wrong simply because there are so many corner cases. It seems like this might be one area where it would be both beneficial and possible to share code between Python web frameworks.

dp

_______________________________________________
Web-SIG mailing list
Web-SIG@python.org
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: 
http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com

Reply via email to