Opened 13 years ago

Closed 13 years ago

#1175 closed defect (invalid)

loading random bytes into CharFields

Reported by: rz_django@… Owned by: Adrian Holovaty
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: no UI/UX: no


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.

Change History (1)

comment:1 Changed 13 years ago by hugo

Resolution: invalid
Status: newclosed

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.

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