I
I
Ivan Vasilich2018-01-30 22:58:20
Python
Ivan Vasilich, 2018-01-30 22:58:20

How to convert raw data to utf-8 in python?

I'm trying to write a bot, or rather make it understand and answer the questions that the user asks. on this article. https://habrahabr.ru/post/326312/
everything is ok, only vk returns raw acii or cyrilic data, what to do with them is not clear.
tried to convert to a string value, not that. in utf-8 is also not the same. in ascii the same is not like.
What does it take to turn it into a normal readable word?

{u'count': 3441,
 u'items': [{u'body': u'\u041f\u0438\u0448\u0435\u043c \u0431\u043e\u0442\u0430 \u0434\u043b\u044f \u0432\u043a!',
   u'date': 1491934484,
   u'id': 7387,
   u'out': 0,
   u'read_state': 0,
   u'title': u' ... ',
   u'user_id': 23107592},
  {u'body': u'\u041f\u0440\u0438\u0432\u0435\u0442 \u0425\u0430\u0431\u0440!',
   u'date': 1491934479,
   u'id': 7386,
   u'out': 0,
   u'read_state': 0,
   u'title': u' ... ',
   u'user_id': 23107592}]}

It returns body --> \u041f\u0440\u0438\u0432\u0435\u0442 \u0425\u0430\u0431\u0440!

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