Strings with null bytes inside sqlite

Jeff Epler jepler at unpythonic.net
Thu Jan 8 17:06:54 EST 2004


It depends on the structure of the string, but using
s.encode("string-escape") / e.decode("string-escape") may give better
performance and better storage characteristics (if your data is mostly
ASCII with a few NULs included).  If chr(0) is the only problem value,
then creating your own encoder/decoder may be better, translating
'\0' -> '\\0' and '\\' -> '\\\\'.

Jeff




More information about the Python-list mailing list