Opened 18 years ago

Closed 17 years ago

#4336 closed (wontfix)

Error when I add a "Poll" (from the tutorial) with the settings.py/language="fr"

Reported by: yml.nospam@… Owned by: nobody
Component: contrib.admin Version: dev
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The Admin Interface fails to add object if the settings.py Language="fr". If I switch the language to the default "en-us" I can add a record. It seems that this is due to french character like "éàè".

Here it is an extract to traceback:

Warning at /admin/dj_survey/survey/add/
Data truncated for column 'message' at row 1
Request Method: POST
Request URL: http://localhost:8000/admin/dj_survey/survey/add/
Exception Type: Warning
Exception Value: Data truncated for column 'message' at row 1
Exception Location: /usr/lib/python2.5/warnings.py in warn_explicit, line 102
Traceback (innermost last)
Switch to copy-and-paste view

  • /media/My Book/work/web_development/svn_views/django/core/handlers/base.py in get_response
    1. # Apply view middleware
    2. for middleware_method in self._view_middleware:
    3. response = middleware_method(request, callback, callback_args, callback_kwargs)
    4. if response:
    5. return response 75.
    6. try:
    7. response = callback(request, *callback_args, callback_kwargs) ...
    8. except Exception, e:
    9. # If the view raised an exception, run it through exception
    10. # middleware, and if the exception middleware returns a
    11. # response, use that. Otherwise, reraise the exception.
    12. for middleware_method in self._exception_middleware:
    13. response = middleware_method(request, e)
    ▶ Local vars

Change History (7)

comment:1 by Malcolm Tredinnick, 18 years ago

Resolution: invalid
Status: newclosed

Non-ASCII input is not supported on Django trunk. That is being remedied in the UnicodeBranch. This problem has been fixed there already.

Closing as "invalid", although it really is a valid bug -- there's no other accurate resolution.

comment:2 by anonymous, 17 years ago

Resolution: invalid
Status: closedreopened

Is still get that kind of error when I use trunk today with language de-de

comment:3 by reg@…, 17 years ago

I have the same problem.
In settings.LANGUAGE_CODE I have tested 'it-IT', 'it-it', 'it', 'it_it', 'it_IT'.
Django trunk r6094, MySQLdb 1.2.2 final, MySQL 5.0.37.
Same problem if I change the table collation to utf-8.

Request Method:  	POST
Request URL: 	http://localhost:8000/admin/flatpages/flatpage/add/
Exception Type: 	Warning
Exception Value: 	Data truncated for column 'message' at row 1
Exception Location: 	/usr/lib/python2.5/warnings.py in warn_explicit, line 102
Python Executable: 	/usr/bin/python
Python Version: 	2.5.1

A solution that may help: set the default encoding to utf8_unicode_ci when you create the database, before the first syncdb.

Davide "Design" Muzzarelli

comment:4 by James Bennett, 17 years ago

#3910 was a duplicate.

comment:5 by Simon G <dev@…>, 17 years ago

Triage Stage: UnreviewedAccepted

in reply to:  3 comment:6 by Oleksandr Pryymak <write at-no-spam ua.fm>, 17 years ago

Replying to reg@dav-muz.net:

A solution that may help: set the default encoding to utf8_unicode_ci when you create the database, before the first syncdb.

really helped - thanks. I've just changed in database dump all charsets and collations to ut8

comment:7 by James Bennett, 17 years ago

Resolution: wontfix
Status: reopenedclosed

This ultimately seems to be a symptom of MySQL tables which were created with a charset/collation that can't handle UTF-8 or the result of translating UTF-8 into the active charset/collation. As such it's really outside the scope of Django -- getting the DB setup wrong is something we can't really help with.

Note: See TracTickets for help on using tickets.
Back to Top