[ANN] pyxser-1.2r --- Python-Object to XML serialization module

Daniel Molina Wegener dmw at coder.cl
Tue Aug 25 14:08:02 CEST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Stefan Behnel <stefan_ml at behnel.de>
on Tuesday 25 August 2009 01:23
wrote in comp.lang.python:


> Stefan Behnel wrote:
>> for all byte
>> strings, regardless of their encoding (since you can't even know if they
>> represent encoded text at all).
> 
> Hmm, having written that, I guess it's actually best to encode byte
> strings as base64 instead. Otherwise, null bytes and other special byte
> values won't pass.

  Sure, base64 is a good option for byte string input.

> 
> I also think that if the user wants readable output for text strings, it's
> reasonable to require Unicode input instead of byte strings. Handling text
> in byte strings is just too error prone.
> 
> Still, you may have to sanitize text input to make sure it doesn't contain
> special characters either. Take a look at the way lxml does it in the
> apihelpers.pxi source file, or read the XML spec on character content.

  Thanks, I will look for that. I must to do a better implementation on
handling byte strings, since would be many cases on where encoded strings
are mixed. For example different database inputs with different
encodings --- if those byte strings are not readed as Unicode strings.

  Both sanitizing and base64 encoding are good options, and also, both are
readable from other platforms. The problem with later implementations of
pyxser was that it was using *RawUnicodeEscape* which is not readable from
other platforms.

> 
> Stefan

Best regards,
- -- 
 .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)

iQIcBAEBCgAGBQJKk9QiAAoJEHxqfq6Y4O5NvxcP/1plIdop5ghbwAKwavU8PSSe
05Lx/3AqThiQTJgG1qIrUXqA70KKGbgnyRAyOb8lTo3E1EcYnrEyM3pIg9xKbEr1
aRbpMVPIUPv//ckJxIwJlszjWoxjpSWKpRFqOkHnBjL6NcAqD7r3LxMLaDKMHNXl
Ka07clukcarEeU5f93mcOpCXMg1XFxfQFr126wbEkC5M2WxwpSJrsX6NIXL34peU
37sjuYOQGEgifw7KKVDNCmt3JNTmojCeRL+xzUiFDXRmm2B9A2Q7fGKKudNC2+u7
d5vUdWUhsK8a2P7o3c8ka/N9hcZ7ESjhlLDjtXEAb45yGUOXkpoOSLznObhGM3H9
MpPbmprvFL8sUX8F8+EOHOAbfaTtTRO384hwY2e7tVaaf6CNutK00Z5nBM7UPdWW
nclS7owNOVsrR62ZGwEcjDwjeYqXp3kIixbbSM9kALu1iKYxaueauIXct6oPQwl7
A3rEmultt7pjfbaDw+kYCouP4YnbPQn84H7Qgle/TMATPgnlD+93OnbCgWhpkx0h
21l4STWHNIZ2yi538lDDnkxKXS9reJQOYiiB9ImueIJJBZhqTwCDiCZDJg7QBVH0
7zsKH70Pbl3ENpTjBmPsxTUbOjzMwaFCbJ/h9+JCLV98TRfwa4KOAsRDC+mThnrY
k6Pj1jxY4uYmAn+xK+x+
=5B9H
-----END PGP SIGNATURE-----



More information about the Python-list mailing list