It would be better to use JSON instead unicode>ast. And a little more secure.
Plus it will be compatible between python3>python2.
TACTIC 4.7 default query() returns HEX instead of unicode strings for some reason.
For example:
Original string "Всякие дескрипшены."
Result from python3 tactic47 '\xd0\x92\xd1\x81\xd1\x8f\xd0\xba\xd0\xb8\xd0\xb5 \xd0\xb4\xd0\xb5\xd1\x81\xd0\xba\xd1\x80\xd0\xb8\xd0\xbf\xd1\x88\xd0\xb5\xd0\xbd\xd1\x8b.'
Don't know what to do with this result with python2 client
Result from python2 tactic45 '\u0412\u0441\u044f\u043a\u0438\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0448\u0435\u043d\u044b.'
print u"\u0412\u0441\u044f\u043a\u0438\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0448\u0435\u043d\u044b.".encode('utf-8')
So the default python eval() do not decode string from python3 tactic47
http://lucumr.pocoo.org/2014/1/5/unicode-in-2-and-3/ - good readings about python3 unicode
So this should be decoded as string:
str('\xd0\x92\xd1\x81\xd1\x8f\xd0\xba\xd0\xb8\xd0\xb5 \xd0\xb4\xd0\xb5\xd1\x81\xd0\xba\xd1\x80\xd0\xb8\xd0\xbf\xd1\x88\xd0\xb5\xd0\xbd\xd1\x8b.').decode('utf-8')
And this should be decoded as unicode:
print unicode(u'\u0412\u0441\u044f\u043a\u0438\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0448\u0435\u043d\u044b.').encode('utf-8').decode('utf-8')
If i have one solid vatiant, it would be better not guessing which string i get in another query
Plus it will be compatible between python3>python2.
TACTIC 4.7 default query() returns HEX instead of unicode strings for some reason.
For example:
Original string "Всякие дескрипшены."
Result from python3 tactic47 '\xd0\x92\xd1\x81\xd1\x8f\xd0\xba\xd0\xb8\xd0\xb5 \xd0\xb4\xd0\xb5\xd1\x81\xd0\xba\xd1\x80\xd0\xb8\xd0\xbf\xd1\x88\xd0\xb5\xd0\xbd\xd1\x8b.'
Don't know what to do with this result with python2 client
Result from python2 tactic45 '\u0412\u0441\u044f\u043a\u0438\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0448\u0435\u043d\u044b.'
print u"\u0412\u0441\u044f\u043a\u0438\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0448\u0435\u043d\u044b.".encode('utf-8')
So the default python eval() do not decode string from python3 tactic47
http://lucumr.pocoo.org/2014/1/5/unicode-in-2-and-3/ - good readings about python3 unicode
So this should be decoded as string:
str('\xd0\x92\xd1\x81\xd1\x8f\xd0\xba\xd0\xb8\xd0\xb5 \xd0\xb4\xd0\xb5\xd1\x81\xd0\xba\xd1\x80\xd0\xb8\xd0\xbf\xd1\x88\xd0\xb5\xd0\xbd\xd1\x8b.').decode('utf-8')
And this should be decoded as unicode:
print unicode(u'\u0412\u0441\u044f\u043a\u0438\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0448\u0435\u043d\u044b.').encode('utf-8').decode('utf-8')
If i have one solid vatiant, it would be better not guessing which string i get in another query