Strings with null bytes inside sqlite

Jeff Epler jepler at
Thu Jan 8 23:06:54 CET 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 '\\' -> '\\\\'.


More information about the Python-list mailing list