#11739: ContentFile() does not support unicode data
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:  nobody
  adamnelson                         |         Status:  closed
                   Type:             |      Component:  File
  Uncategorized                      |  uploads/storage
              Milestone:             |       Severity:  Normal
                Version:  1.1        |       Keywords:
             Resolution:             |      Has patch:  0
  worksforme                         |    Needs tests:  0
           Triage Stage:             |  Easy pickings:  0
  Unreviewed                         |
    Needs documentation:  0          |
Patch needs improvement:  0          |
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
Changes (by anonymous):

 * ui_ux:   => 0
 * type:   => Uncategorized
 * severity:   => Normal
 * easy:   => 0


Comment:

 I've met the same problem..[[BR]]
 when I render a template_file to a static_file...and save in a FileField
 for further usage..[[BR]]

 the result below is the same as model.file.save(..., ...)[[BR]]
 and I have to encode it first...of course not a good solution...

 {{{
 >>> from django.core.files.base import ContentFile
 >>> ContentFile(u'test').read()
 't\x00e\x00s\x00t\x00'
 >>> ContentFile(u'test'.encode('gb2312')).read()
 'test'
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/11739#comment:5>
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