On Mon, 14 Mar 2005, Stefan Elwesthal wrote:
> I'm swedish, our databae is full of horrible characters with strange > dots on top and Python won't have none of it. it falls apart telling me > that it can't decode that sort of thingy! > > So.. will I have to do some terrible magic storing all single values > from the database in strings and run unicode methods on them before > showing them in my wxGrid or is there a better way? (I'm going on > bragging about how little code I need to write when I'm NOT using java.. > ;) Hi Stefan, According to the wxpython-users list: http://aspn.activestate.com/ASPN/Mail/Message/wxpython-users/2514927 when you're setting the cell values, those values should be unicode strings. When you grab strings from the database, you'll probably need to take to know how they're encoded so that you can decode them properly. For example, if you know that the bytes in your database represent utf-8 characters, you probably need to do something like: ### Pseudocode decodedString = someStringInUtf8.decode("utf8") ### wxPython should handle the rest, though you probably want to talk with the wxpython-users directly to make sure. Here's a link to their mailing lists: http://www.wxpython.org/maillist.php Kent Johnson once posted an excellent set of link on Unicode basics on the tutor list. If you want to read a little more about Unicode, I'd recommend his article and the other one that he quoted. For your convenience, I'll just copy his links. *grin* http://www.pycs.net/users/0000323/stories/14.html http://www.joelonsoftware.com/articles/Unicode.html _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor