On 30 Jul 2006, at 14:08, Mikko Nylén wrote:
> I tried to change all 'ä's with \xe4 and 'ö's with \xf6 and with  
> those I was
> able to make the messages compile. However, when trying to launch the
> built-in server, I get error saying "UnicodeDecodeError: 'utf8'  
> codec can't
> decode bytes in position 26-28: invalid data".
>
> I'm using Vim as my editor and I have set "set encoding=utf-8"  
> in .vimrc.
> Also, in the django.po I have line "Content-Type: text/plain;
> charset=utf-8". Is there something else I'm missing?

I don’t know much about Vim, but it appears your ö and ä are entered  
with an encoding different than UTF-8. Python then tries to decode  
your characters thinking they might be valid UTF-8, but they are not,  
so it raises the UnicodeDecodeError.

FYI: ä (LATIN SMALL LETTER A WITH DIAERESIS) in UTF-8 is \xc3\xa4,  
whereas \xe4 is its encoded form in ISO-8859-1/Latin-1 (and  
ISO-8859-10/Latin-6 as well, I haven’t looked at other encodings).

I googled a bit, and found this page [1] where it says that to set  
your Vim to the UTF-8 encoding you have to use the following command  
(note the column at the beginning):

:set encoding=utf-8

[1] http://www.vim.org/htmldoc/mbyte.html

> Also, I'd like to ask how different timezones should be handled? I'm
> building an application where it would be necessary for the users  
> to be able
> to choose their own timezone to display date and time information  
> correctly.
> One option would be, of course, to save the date and time returned by
> datetime.utcnow() to database and then for each user have setting
> "timezone", which would tell the offset from UTC in seconds.

Yeah, this way sounds reasonable to me.

You may also want to have a look at pytz:

http://pytz.sourceforge.net/

Cheers!
-- 
Antonio



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to