ok, here is the Traceback (and my DB encoding is utf8-general-ci): Traceback (most recent call last):
File "/usr/local/alwaysdata/python/django/1.2.1/django/core/handlers/ base.py", line 100, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/usr/local/alwaysdata/python/django/1.2.1/django/contrib/admin/ options.py", line 239, in wrapper return self.admin_site.admin_view(view)(*args, **kwargs) File "/usr/local/alwaysdata/python/django/1.2.1/django/utils/ decorators.py", line 76, in _wrapped_view response = view_func(request, *args, **kwargs) File "/usr/local/alwaysdata/python/django/1.2.1/django/views/ decorators/cache.py", line 69, in _wrapped_view_func response = view_func(request, *args, **kwargs) File "/usr/local/alwaysdata/python/django/1.2.1/django/contrib/admin/ sites.py", line 190, in inner return view(request, *args, **kwargs) File "/usr/local/alwaysdata/python/django/1.2.1/django/utils/ decorators.py", line 21, in _wrapper return decorator(bound_func)(*args, **kwargs) File "/usr/local/alwaysdata/python/django/1.2.1/django/utils/ decorators.py", line 76, in _wrapped_view response = view_func(request, *args, **kwargs) File "/usr/local/alwaysdata/python/django/1.2.1/django/utils/ decorators.py", line 17, in bound_func return func(self, *args2, **kwargs2) File "/usr/local/alwaysdata/python/django/1.2.1/django/db/ transaction.py", line 299, in _commit_on_success res = func(*args, **kw) File "/usr/local/alwaysdata/python/django/1.2.1/django/contrib/admin/ options.py", line 798, in add_view self.save_formset(request, form, formset, change=False) File "/usr/local/alwaysdata/python/django/1.2.1/django/contrib/admin/ options.py", line 603, in save_formset formset.save() File "/usr/local/alwaysdata/python/django/1.2.1/django/forms/ models.py", line 487, in save return self.save_existing_objects(commit) + self.save_new_objects(commit) File "/usr/local/alwaysdata/python/django/1.2.1/django/forms/ models.py", line 625, in save_new_objects self.new_objects.append(self.save_new(form, commit=commit)) File "/usr/local/alwaysdata/python/django/1.2.1/django/forms/ models.py", line 737, in save_new obj.save() File "/usr/local/alwaysdata/python/django/1.2.1/django/db/models/ base.py", line 435, in save self.save_base(using=using, force_insert=force_insert, force_update=force_update) File "/usr/local/alwaysdata/python/django/1.2.1/django/db/models/ base.py", line 518, in save_base for f in meta.local_fields if not isinstance(f, AutoField)] File "/usr/local/alwaysdata/python/django/1.2.1/django/db/models/ fields/files.py", line 255, in pre_save file.save(file.name, file, save=False) File "/usr/local/alwaysdata/python/django/1.2.1/django/db/models/ fields/files.py", line 92, in save self.name = self.storage.save(name, content) File "/usr/local/alwaysdata/python/django/1.2.1/django/core/files/ storage.py", line 47, in save name = self.get_available_name(name) File "/usr/local/alwaysdata/python/django/1.2.1/django/core/files/ storage.py", line 73, in get_available_name while self.exists(name): File "/usr/local/alwaysdata/python/django/1.2.1/django/core/files/ storage.py", line 196, in exists return os.path.exists(self.path(name)) File "/usr/languages/python/2.6/lib/python2.6/genericpath.py", line 18, in exists st = os.stat(path) UnicodeEncodeError: 'ascii' codec can't encode character u'\xe7' in position 53: ordinal not in range(128) <WSGIRequest ... META:{'CONTENT_LENGTH': '176634', 'CONTENT_TYPE': 'multipart/form-data; boundary=---------------------------21724139663430', ... 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/ xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE': 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3', 'HTTP_CONNECTION': 'close', ... 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv: 1.9.2.10) Gecko/20100914 Firefox/3.6.10', ... 'REDIRECT_STATUS': '200', ... 'REQUEST_METHOD': 'POST', 'REQUEST_URI': '/admin/biens/bien/add/', 'SCRIPT_FILENAME': '/.../django.fcgi', 'SCRIPT_NAME': u'', ... 'SERVER_ADMIN': '[no address given]', ... 'SERVER_PORT': '80', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SIGNATURE': '', 'SERVER_SOFTWARE': 'Apache/2.2', 'TZ': '/etc/localtime', 'wsgi.errors': <flup.server.fcgi_base.OutputStream object at 0x3309590>, 'wsgi.input': <flup.server.fcgi_base.InputStream object at 0x33093d0>, 'wsgi.multiprocess': False, 'wsgi.multithread': True, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)}> thanks, _y On Sep 29, 8:15 pm, Steve Holden <holden...@gmail.com> wrote: > It might be helpful to provide rather more of the traceback information. > > Also, check your database encoding. Somehow you are requiring Django to > convert a Unicode string in to an ASCII string. > > regards > Steve > > On 9/29/2010 2:01 PM, jean polo wrote: > > > > > hi Steve > > > do you have any advices for where to look for this to happen ? > > > I have a basic 'Bien' class and a *very basic* 'Image' class (with a > > ForeignKey to Bien). > > BienAdmin has a ImageInline and that's all. > > > I am a bit confused.. > > > cheers, > > _y > > > On Sep 29, 7:39 pm, Steve Holden <holden...@gmail.com> wrote: > >> It sounds to me as though the image is being transmitted with the wrong > >> MIME Type. Image files are binary data, but something in your > >> application is treating is as a string. > > >> regards > >> Steve > > >> On 9/29/2010 1:05 PM, werefr0g wrote: > > >>> Hi, > > >>> You should check that your file is actually utf-8 encoded and add the > >>> folliwing right after shebang: > >>> # -*- coding: utf-8 -*- > > >>> Le 29/09/2010 18:59, jean polo a crit : > >>>> Hi. > >>>> I get an 'UnicodeEncodeError' if I upload a file (ImageField) with non- > >>>> ascii chars in my application (django-1.2.1). > > >>>> I added: > > >>>> export LANG='en_US.UTF-8' > >>>> export LC_ALL='en_US.UTF-8' > > >>>> in my /etc/apache2/envvars as stated here: > >>>>http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#if-y... > > >>>> but I still have the same error (after restarting apache). > >>>> Any hint much appreciated. > > >>>> cheers, > >>>> _y > > >>>> ps: > > >>>> Traceback (most recent call last): > >>>> [snip] > >>>> File "/usr/languages/python/2.6/lib/python2.6/genericpath.py", line > >>>> 18, in exists > >>>> st = os.stat(path) > > >>>> UnicodeEncodeError: 'ascii' codec can't encode character u'\xe7' in > >>>> position 53: ordinal not in range(128) > > >>> -- > >>> You received this message because you are subscribed to the Google > >>> Groups "Django users" group. > >>> To post to this group, send email to django-us...@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. > > >> -- > >> DjangoCon US 2010 September 7-9http://djangocon.us/ > > -- > DjangoCon US 2010 September 7-9http://djangocon.us/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.