-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Stefan Behnel <stefan...@behnel.de> on Sunday 19 April 2009 15:08 wrote in comp.lang.python:
> Daniel Molina Wegener wrote: >> Stefan Behnel <stefan...@behnel.de> >> on Sunday 19 April 2009 02:25 >> wrote in comp.lang.python: >> >> >>> Daniel Molina Wegener wrote: >>>> * Every serilization is made into unicode objects. >>> Hmm, does that mean that when I serialise, I get a unicode object back? >>> What about the XML declaration? How can a user create well-formed XML >>> from your output? Or is that not the intention? >> >> Yes, if you serialize an object you get an XML string as >> unicode object, since unicode objects supports UTF-8 and >> some other encodings. > > That's not what I meant. I was wondering why you chose to use a unicode > string instead of a byte string (which XML is defined for). If your only > intention is to deserialise the unicode string into a tree, that may be > acceptable. However, as soon as you start writing the data to a file or > through a network pipe, or pass it to an XML parser, you'd better make it > well-formed XML. So you either need to encode it as UTF-8 (for which you > do not need a declaration), or you will need to encode it in a different > byte encoding, and then prepend a declaration yourself. In any case, this > is a lot more overhead (and cumbersome for users) than writing out a > correctly serialised byte string directly. Sorry, it appears that I've misunderstand your question. By /unicode objects/ I mean /python unicode objects/ aka /python unicode strings/. Most of them can be reencoded into /latin*/ strings and then /ascii/ strings if is that what you want. But for most communications, suchs as Java systems, utf-8 encoding goes as default. I've made pyxser to generate interoperability between python and other systems. > > You seemed to be very interested in good performance, so I don't quite > understand why you want to require an additional step with a relatively > high performance impact that only makes it harder for users to use the > tool correctly. > > Stefan Atte. - -- .O. | Daniel Molina Wegener | FreeBSD & Linux ..O | dmw [at] coder [dot] cl | Open Standards OOO | http://coder.cl/ | FOSS Developer -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iQIcBAEBCgAGBQJJ6+7fAAoJEHxqfq6Y4O5NC3cQAKbjssbbGbIIKSAD+OKj3KCm dyJw4PePeXnYMlbEWvYY+QRkpQbJMSRISFjOIKS3IFtUcJIuAA94XjTMuvDt8L1X k5oClZlEOPQU3tXuuMTA6AuhZVzW4RSkz0fNhVdi6RZve+rscmjZMIWz95uygnet ct1J6y9JRN2BmBgoBa5A72tcIvNQBx/T7Q2iUk1oUB6iLZutQejEeUeHT7p89e4d x38+mVZqpPYoZNn4Sxwcz61LgYEYQH7sIfzup8+6qv8CiDRD6PFrP1DBcV08mtYO PBDGyK9RBHDVPqZ0SK40uNdX3TROprllaf41XDas8602xGsgJR64xwBM9s21yWcu Z2ovweYvwEivqJeg+H6sWvKILJIqa1tkSM/JU2Gm5//cQstt2nfx5eoW07UrLmSb qH0T7Gvg+pd060HbkQ3bgxumG5iIAtTOoix8V5R+ILYtdxWHsEXizm+XMKQITQTt jngR0zoFwsdSesMwUdFD/RE4vpE4z9KErBcdO3Rhc5AbyR7HZwqemQ2KiloXg207 nn3hrZOz8GgHXeIg8nAugFOxJ6b2RxDJPb8zf6vjC9FFO8PESyb3kKz+XvaeMx2f 0eVaWhgiuNTxPyC/JJWO8yVizoQA1uXPGC6H0dhGxqMNNb4K7mtcQVNUpogzHq4X lwz4KllmL7b4YWpd983D =TEqt -----END PGP SIGNATURE----- -- http://mail.python.org/mailman/listinfo/python-list