> David Koblas <[EMAIL PROTECTED]> writes: >> I'm finding it a bit tidious to constantly be casting from str(...) to >> unicode(...) to keep the database happy. Is there really a best >> practice for how to have VARCHAR columns that are should be treated as >> RawStr() for purposes of development?
There is a best practice: It's to never rely on automatic encoding or decoding of str and unicode objects. On all I/O boundaries (web input / output, email input / output, file I/O, etc), you need to explicitly encode and decode with the appropriate encoding (utf-8, ascii, utf-16, etc) for the given transport. If you do end up using automatic encoding and decoding, then your app will most likely break some time when a user comes along and decides to enter characters that don't fit in ASCII. -- Christopher Armstrong International Man of Twistery http://radix.twistedmatrix.com/ http://twistedmatrix.com/ http://canonical.com/ -- storm mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm
