I'm having the same problem with django svn (rev 7135). It happens only with
fcgi (I'm using lighttpd), not with "runserver". Also, sometimes there's no
error, but usually the second time I reload an exception is raised (so the
same page can display fine one time, and the next time it raises an error). 

Putting DATABASE_OPTIONS = { 'charset': 'latin1', } in settings.py seems to
fix the problem. 
My DB, tables and fields are set to utf8_general_ci.

Traceback:
File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py" in
get_response
  73.             callback, callback_args, callback_kwargs =
resolver.resolve(request.path)
File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py" in
resolve
  231.             for pattern in self.urlconf_module.urlpatterns:
File "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py" in
_get_urlconf_module
  251.                 self._urlconf_module = __import__(self.urlconf_name,
{}, {}, [''])
File "/home/gestev/django/invitation/../invitation/urls.py" in ?
  3. from invitation.app import views as appviews
File "/home/gestev/django/invitation/../invitation/app/views.py" in ?
  10. from invitation.app.forms import *
File "/home/gestev/django/invitation/../invitation/app/forms.py" in ?
  20. class AjouterInvitationForm(forms.Form):
File "/home/gestev/django/invitation/../invitation/app/forms.py" in
AjouterInvitationForm
  22.     partenaire = forms.ChoiceField(choices=choices_partenaires())
File "/home/gestev/django/invitation/../invitation/app/forms.py" in
choices_partenaires
  8.     for part in partenaires:
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
__iter__
  114.         return iter(self._get_data())
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
_get_data
  483.             self._result_cache = list(self.iterator())
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
iterator
  189.         cursor.execute("SELECT " + (self._distinct and "DISTINCT " or
"") + ",".join(select) + sql, params)
File "/usr/lib/python2.4/site-packages/django/db/backends/util.py" in
execute
  18.             return self.cursor.execute(sql, params)
File "/usr/lib/python2.4/site-packages/MySQLdb/cursors.py" in execute
  163.             self.errorhandler(self, exc, value)
File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py" in
defaulterrorhandler
  35.     raise errorclass, errorvalue

Exception Type: UnicodeDecodeError at /evenement/1/
Exception Value: 'utf8' codec can't decode bytes in position 1-3: invalid
data


Meista wrote:
> 
> 
> It seems that the first database query that returns utf-8 encoded
> stuff (i.e my last name) almost always raises this error.
> If i do a "python manage.py runserver" it always works, with "python ./
> manage.py runfcgi" not.
> 
> Im confused :(
> 
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Random-UnicodeDecodeError----tp15475706p15670756.html
Sent from the django-users mailing list archive at Nabble.com.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to