Opened 8 years ago

Closed 8 years ago

#1175 closed defect (invalid)

loading random bytes into CharFields

Reported by: rz_django@… Owned by: adrian
Component: Database layer (models, ORM) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Loading random bytes into CharFields is allowed - no error either when assigning the value or when saving the entry.. However, ANY further access to the item or anything with a onetomanyfield relation to this item will bomb with a fairly vague utf8 decoding error. The operation that actually loads the corrupted data into the CharField should generate the exception - bug hunting this way is completely impossible if any database error occurs in the wrong module at the wrong time.

Attachments (0)

Change History (1)

comment:1 Changed 8 years ago by hugo

  • Resolution set to invalid
  • Status changed from new to closed

CharFields are supposed to be filled with chars in the DEFAULT_ENCODING of your project. You have to make sure that your database uses the same encoding as your project - for example in PostgreSQL, you can create the database with utf-8 encoding to make sure that data you load into charfields is allways stored and retrieved as correct utf-8.

Add Comment

Modify Ticket

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

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

Note: See TracTickets for help on using tickets.