On 10/21/10 10:23 AM, Ed Leafe wrote: > On Oct 21, 2010, at 1:17 PM, John Fabiani wrote: > >> How does this work if the database is saving English and the app is written >> in >> Spanish. > > > Encoding has nothing to do with language. It is simply a method of > representing characters that can take up more than one byte of storage. One > byte can specify up to 256 different characters, and since there are many > more potential characters than that, a system for encoding those characters > into byte streams is needed. "utf8" is the most popular system, but there are > others. The important thing is that when reading back the byte stream, either > from disk or from a database, you have to decode those bytes to get back the > original characters.
One principle of dealing with Unicode that makes a lot of sense to me is "do the encoding/decoding at the I/O interface". This means, do the encoding at the last possible moment before saving to disk or sending over the network, and do the decoding at the first possible moment after reading from disk or the network. What encoding to use in any given context should perhaps fall back to dabo.defaultEncoding but in the case of SQLite, it should be the encoding the sqlite database is set to. At least, that's my conclusion but the reason I posed the question instead of just committing the change was to test my conclusion among my peers. I've been forced to delve a bit into the unicode thing because as it stands right now, my users will get errors reading or writing non-ascii characters from/to their sqlite database. I'm still sorting out all the issues and trying to figure out what has fundamentally changed in the past 3 months in Dabo (and/or moving to python 2.6 from 2.5) to account for these problems I'm seeing. Paul _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev Searchable Archives: http://leafe.com/archives/search/dabo-dev This message: http://leafe.com/archives/byMID/[email protected]
