2👍
✅
You need to put a u
in front of r
before the string, or wrap it in the unicode method:
See this for more info.
Unicode strings are much like strings, but are specified in the syntax
using a preceding ‘u’ character: u’abc’, u”def”.
1👍
First, to use non-ASCII characters in a string literal in Python you need to specify a character encoding at the top of your source file e.g.:
# -*- coding: utf-8 -*-
Second, if you pass a Unicode string to django it usually does the right thing by itself. In this case it should convert all non-ASCII characters in the URL. If it is not then you could call django.utils.encoding.iri_to_uri()
explicitly.
👤jfs
- [Django]-How to store a MAC address field in a django model?
- [Django]-@monthly cron job is not reliable
- [Django]-Youtube Plugin for Django Ckeditor Updated
- [Django]-How to store and read common data in redis from python and rust?
Source:stackexchange.com