Opened 8 years ago

Closed 8 years ago

#6692 closed (duplicate)

Saving NUL character truncates string using SQLite

Reported by: Alexandre Martani <amartani@…> Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


When I try to save a string containing NUL character (\x00), only the
part before the character is saved. I have created a simple model:

class Test(models.Model):
  content = models.TextField()

And this happens:

>>> from mysite.test.models import Test
>>> test = Test(content="blabla\x00blablabla")
>>> test.content
>>> Test.objects.get(pk=1).content
>>> test.content

The end of the string is simply lost, no errors are raised, nothing. Since python supports NUL character in strings, Django should support them too, or just drop it, but not losing all the end of the string.
This happens on Django 0.96.1 and SVN, using SQLite database.

Change History (1)

comment:1 Changed 8 years ago by mattmcc

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

Duplicate of #2417.

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