On Thu, 28 Apr 2011 00:49:40 -0300, Daniel França <daniel.fra...@gmail.com> wrote: > I'm getting a lot of problems saving and reading from files with special > characteres in name, using the django-avatar lib. > > The truth is that I don't really understand the way python/django handle > unicodes, for example, I suspect that from the moment the trace tells me > that there's some strange characters in my variable I can't do anything > anymore... like try to use the unicode() method.
Ah, you need to make yourself familiar with Python's unicode support. The problems arise as soon as one of your users enters non-ASCII-characters e.g. as file name. In Django, all strings that go into the database must be unicode strings and will be converted to unicode strings if they are not. This fails as soon as there are non-ASCII-characters in the string. I can recommend for reading: http://www.joelonsoftware.com/articles/Unicode.html http://www.stereoplex.com/blog/python-unicode-and-unicodedecodeerror http://docs.python.org/howto/unicode.html It's nothing about Django, just Python. Hope that helps a bit. Kind regards Michael -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.