Roger Binns wrote: > Yang Zhang wrote: >> Actually, this is only because Python 3 str is Python 2 unicode. Python >> 2 (which I'm currently using, and which I believe most of the world is >> using) str is a physical string of bytes, not a logical/decoded >> character string. Python 2.6 introduces bytes as a synonym for str, but >> I am using Python 2.5 at the moment. > > This is all pedantically true, but it is still a really bad way to > structure your program? Did you read the Joel Unicode and character > sets link?
I *have* in fact read that article a very, very long time ago, but that is besides the point. I am aware of character encoding issues, thanks. > > It was because Python 2 messed up on bytes versus strings versus unicode > that they had to clean it up in Python 3. It is also why the SQLite > wrappers in Python 2 return blobs as the buffer type so that there is no > accidental mingling of bytes and strings. (Disclosure: I am the author > of the APSW wrapper) SQLite *only* supports Unicode strings. Other > databases do support non-Unicode strings, character set conversions and > all that other complexity. I require str because that is what cPickle.loads() requires; you cannot pass it a buffer. I need to store pickled objects in the database because I am implementing an SQLite backend for the Python 2 shelve module. -- Yang Zhang http://www.mit.edu/~y_z/ _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users