#11994: save upload file with specify encode ----------------------------------+----------------------------------------- Reporter: [email protected] | Owner: nobody Status: new | Milestone: Component: File uploads/storage | Version: 1.1 Keywords: | Stage: Unreviewed Has_patch: 0 | ----------------------------------+----------------------------------------- {{{ # -*- coding: utf-8 -*- # in models.py def get_path(instance, filename): path = osp.join('uploads', '中文'.encode('utf8'), filename) return path class Files(models.Model): name = models.CharField(max_length=64) files = models.FileField(upload_to=get_path, storage=MyStorage) }}}
Upload file with above code on Chinese version MS-Windows, it will get strange filename which contains unreadable characters. I guess this problem associated with Chinese version MS-Windows using GBK encoding by default. After read debug a long time and has read http://docs.djangoproject.com/en/dev/howto/custom-file-storage/, I think use custom storage which could specify save file with specify encode, such as GBK could fix my problem. Django is a very very very good Web framework, I hope developers could add this feature, and please don't try to restrict user or down stream developers, thanks. -- Ticket URL: <http://code.djangoproject.com/ticket/11994> Django <http://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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---
