Merge "Set unicode_errors handler to 'surrogateescape' in msgpack"
This commit is contained in:
commit
6b5bbbb148
|
@ -51,7 +51,8 @@ class Serializer(object):
|
||||||
self.writesock = writesock
|
self.writesock = writesock
|
||||||
|
|
||||||
def send(self, msg):
|
def send(self, msg):
|
||||||
buf = msgpack.packb(msg, use_bin_type=True)
|
buf = msgpack.packb(msg, use_bin_type=True,
|
||||||
|
unicode_errors='surrogateescape')
|
||||||
self.writesock.sendall(buf)
|
self.writesock.sendall(buf)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
|
@ -64,7 +65,8 @@ class Serializer(object):
|
||||||
class Deserializer(six.Iterator):
|
class Deserializer(six.Iterator):
|
||||||
def __init__(self, readsock):
|
def __init__(self, readsock):
|
||||||
self.readsock = readsock
|
self.readsock = readsock
|
||||||
self.unpacker = msgpack.Unpacker(use_list=False, encoding='utf-8')
|
self.unpacker = msgpack.Unpacker(use_list=False, encoding='utf-8',
|
||||||
|
unicode_errors='surrogateescape')
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return self
|
return self
|
||||||
|
|
|
@ -72,7 +72,7 @@ class TestSerialization(base.BaseTestCase):
|
||||||
self.assertSendable(data)
|
self.assertSendable(data)
|
||||||
|
|
||||||
def test_unicode(self):
|
def test_unicode(self):
|
||||||
data = u'\u4e09\u9df9'
|
data = u'\u4e09\u9df9\udc82'
|
||||||
self.assertSendable(data)
|
self.assertSendable(data)
|
||||||
|
|
||||||
def test_tuple(self):
|
def test_tuple(self):
|
||||||
|
|
Loading…
Reference in New Issue