[Ironpython-users] question about international encodings
sepatan at sibmail.com
sepatan at sibmail.com
Fri Apr 12 10:13:20 CEST 2013
Not be obtained from IronPython (DLR Silverlight) transfer Russian text
HTTP (XMLHttpRequest POST). example:
# -*- coding: utf-8 -*-
import cPickle
import _codecs as codecs
import sys
print sys.getdefaultencoding()
t_ish='Привет Салют!'
picl=cPickle.dumps(t_ish)
un_picl=cPickle.loads(picl)
print '--------------------'
print picl
print '===================='
print '--------------------'
print codecs.utf_8_encode(un_picl)
print '===================='
The result
ascii
--------------------
V\u041f\u0440\u0438\u0432\u0435\u0442 \u0421\u0430\u043b\u044e\u0442!
p0
.
====================
--------------------
(u'\xd0\x9f\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82
\xd0\xa1\xd0\xb0\xd0\xbb\xd1\x8e\xd1\x82!', 13)
====================
I'm trying to pass on picl XMLHttpRequest (JavaScript), does not work.
Suspect picl not utf-8.
Can someone tell me how t_ish serialized to pass HTTP (XMLHttpRequest
POST), and deserialize to get the expected result:
t_ish='Привет Салют!'
And how do you know what encoding the string (for example t_ish)?
More information about the Ironpython-users
mailing list