#11739: ContentFile() does not support unicode data
--------------------------------------+------------------------------------
     Reporter:  adamnelson            |                    Owner:  nobody
         Type:  Bug                   |                   Status:  reopened
    Component:  File uploads/storage  |                  Version:  1.1
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  1                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------

Comment (by lrekucki):

 Did a little research on this: The docs show the use of unicode with
 {{{ContentFile}}} only once and it's with explicit encoding to UTF-8. Even
 after fixing the cStringIO bug (It has been fixed in 2.7.3, see
 http://bugs.python.org/issue1548891) passing unicode would still work only
 if the unicode string can be encoded to ASCII.

 Note that in Python 3, there is no {{{StringIO}}} that accepts both bytes
 and unicode. One must rather explicitly choose between BytesIO and
 StringIO.

 As the workaround for this bug is very simple and this has been for a
 while now, I propose to document ContentFile being bytes only and throwing
 a ValueError if given unicode. In Django 1.5, we can start using the new
 {{{io}}} and introduce {{{TextContentFile}}} that will use io.TextIO.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/11739#comment:16>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to