UnicodeEncodeError: 'ascii' codec can't encode character

前端 未结 12 819
予麋鹿
予麋鹿 2020-11-30 20:31

When uploading files with non-ASCII characters I get UnicodeEncodeError:

Exception Type: UnicodeEncodeError at /admin/studio/newsitem/add/
Exception Value: \         


        
12条回答
  •  悲&欢浪女
    2020-11-30 20:54

    If you're using django and python 2.7 this fixes it for me:

    @python_2_unicode_compatible
    class Utente(models.Model):
    

    see https://docs.djangoproject.com/en/dev/ref/utils/#django.utils.encoding.python_2_unicode_compatible

提交回复
热议问题