How to decode ascii in python
<p>I send cyrillic letters from postman to django as a parameter in url and got something like <code>%D0%B7%D0%B2</code> in variable <code>search_text</code></p>

<p>actually if to print <code>search_text</code> I got something like <code>текст</code> printed</p>

<p>I've tried in console to make the following and didn't get an error</p>

<pre><code>&gt;&gt;&gt; a = "текст"
&gt;&gt;&gt; a
'\xd1\x82\xd0\xb5\xd0\xba\xd1\x81\xd1\x82'
&gt;&gt;&gt; print a
текст
&gt;&gt;&gt; b = a.decode("utf-8")
&gt;&gt;&gt; b
u'\u0442\u0435\u043a\u0441\u0442'
&gt;&gt;&gt; print b
текст
&gt;&gt;&gt;
</code></pre>

<p>by without console I do have an error:</p>

<pre><code>"""WHERE title LIKE '%%{}%%' limit '{}';""".format(search_text, limit))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
</code></pre>

<p>How to prevent it?</p>