I
I
Ivan Vasilich2018-02-02 12:26:00
Python
Ivan Vasilich, 2018-02-02 12:26:00

Can't figure out what's wrong with encodings or what's going on in python at all?

vk bot returns the result {body: somedata }
if the result of the body variable is output to the console, it gives the
following u'\u043f\u0440\u0438\u0432\u0435\u0442'
how to convert it into a readable form??
I thought that chatterbot does not accept the Cyrillic alphabet, but there is support for it, as I understand it.
tried like this

#if isinstance(msg, unicode):
        #    message = msg.encode('utf8')
        #message = u''.join(msg.encode('ascii', 'ignore').decode('ascii'))
        #pprint(message)

and that's how it still falls,
msg.encode('utf8').decode('utf8')
I'm new to python and I can't understand what's going on here, I've already broken my head.
In general, this result should be accepted by chatterbot and answer, but either it falls or vk bot falls with English words, there is no such thing. everyone answers and "learn"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2018-02-02
@NeiroNx

It all depends on the encoding in the console. On MS Windows, this is CP866 5a74338159c0c928836062.png
. But I suspect that this is caused by a feature of object serialization:5a74378a2a69d461547604.png

I
Ivan Vasilich, 2018-02-02
@jcmax

how to turn off data serialization? I'm new to python, as I understand it, serialization is a bunch of variables thrown off into one variable ???

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question