On Jul 31, 11:55 am, alecs <alecs....@gmail.com> wrote:
> I'm sending a file to user:
>
> upfile = UpFile.objects.get(file_hash=request.path[6:])
>         user = get_object_or_404(User, username=request.user.username)
>         down_file_log = DownFile.objects.create(user_id=user,
> file_id=upfile)
>         wrapper = FileWrapper(file(upfile.file_path))
>         response = HttpResponse(wrapper)
>         response['Content-Length'] = os.path.getsize(upfile.file_path)
>         response['Content-Type'] = upfile.file_content_type + ';
> charset=utf8'
>         response['Content-Disposition'] = 'attachment; filename=\"' +
> upfile.file_name + '\"'
>         return response
>
> Mysql database encoding is utf8_bin.
> The problem is in the filename: everything works OK with English, but
> if the file_name is in Russian then in IE6 it's horrible and unreadable
> (when you press on file link and download window appears) :(( But in
> Firefox && Opera it's OK :((
> Any suggestions ?

This *might* work:
     content_disp = u'attachment; filename="%s" ' % upfile.file_name
     response['Content-Disposition'] = content_disp.encode('utf-8')
--
DR.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to