B
B
blackbb2017-08-05 17:29:44
Django
blackbb, 2017-08-05 17:29:44

How to solve encoding issue in python 3?

As I understand it, in version 3 all characters are initially in utf-8, but here's the problem, there is this code:

idsender = "111111-11111-1111-11111-11111111"
        subject = 'Привет'
        to = '79286666666'
        url = "http://sms.ru/sms/send?api_id=%s&text=%s&to=%s" % (idsender, subject, to)
        res = urlopen(url)

On execution it gives the error 'ascii' codec can't encode characters in position 63-68: ordinal not in range(128). Tried to put .encode('utf-8') to a line, then "crazy" come. How to fix?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question