21👍
✅
You’re trying to encode / decode strings, not Unicode strings. The following statements do work:
u'ç'.encode('utf8')
u'á'.encode('utf-8')
unicode(u'ç')
u'ç'.encode('utf-8','ignore')
3👍
Use u'...'
, without the u
prefix it is byte-string not a unicode string.:
>>> u'ç'.encode('utf8')
'\xc3\xa7'
- Django factory boy factory with OneToOne relationship and related field
- Django reset_password_confirm TemplateSyntaxError problem
- Determine if an attribute is a `DeferredAttribute` in django
- Graphene-python performance issues for large data sets
- Python/Django polling of database has memory leak
Source:stackexchange.com