On Tue, 2007-05-08 at 10:13 -0700, Gerard M wrote: > Hello dear django community, I'm having a bad time with an issue that > I haven't been able to solve with my database, the problem is this: > Whenever I try to save a word containing "special" characters in it > (for example áéíóú) I get the following django error: > "invalid byte sequence for encoding "UTF8": 0xe92020 HINT: This error > can also happen if the byte sequence does not match the encoding > expected by the server, which is controlled by "client_encoding"." > I know that I need to set something to my database/table but I dont > know where or how to achieve this, when I type" show;" at the > postgresql shell it tells me that my database is UTF-8 encoding. > > I solved a problem like this in MySQL with the following commands: > > alter database <DBname> character set utf8 collate utf8_general_ci; > alter table <tablename> convert to character set utf8 collate > utf8_general_ci; > > I dont know if something like this exists in postgresql, or if there > is something else I can do or I should be doing, thanks for your help, > and your time for reading this post.
All the other posts in this thread have zoomed in on the root cause of the problem, so I won't revisit that. The good news is that we are in the process of making this all a lot easier. See http://code.djangoproject.com/wiki/UnicodeBranch . That branch isn't 100% usable yet, because form encoding isn't handled correctly (which particularly leads to some problems in the Admin interface) and a few other cases, but it's getting close. Should be finished in a week or so. If you can wait a little while until we finish that branch and then merge it with trunk, that should make dealing with non-ASCII strings a lot easier. You will still have to ensure that any bytestrings (non-unicode strings) you are passing around internally to Django are UTF-8 encoded, but that's not going to be a big deal, normally. What you will be able to do is pass around (and receive back) unicode strings everywhere and not have to worry about encoding much at all. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---