Code

Opened 7 years ago

Closed 6 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: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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

Attachments (0)

Change History (7)

comment:1 Changed 7 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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 Changed 7 years ago by anonymous

  • Resolution invalid deleted
  • Status changed from closed to reopened

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

comment:3 follow-up: Changed 7 years ago by reg@…

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 Changed 7 years ago by ubernostrum

#3910 was a duplicate.

comment:5 Changed 6 years ago by Simon G <dev@…>

  • Triage Stage changed from Unreviewed to Accepted

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

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 Changed 6 years ago by ubernostrum

  • Resolution set to wontfix
  • Status changed from reopened to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.