replace "utf8" alias by canonical "utf-8" locale code + remove the second Python2 vs Py3 compat.py
Client: py
Patch: Alexandre Detiste
This closes #3105
diff --git a/lib/py/src/protocol/TProtocol.py b/lib/py/src/protocol/TProtocol.py
index ec71ab3..a7336c5 100644
--- a/lib/py/src/protocol/TProtocol.py
+++ b/lib/py/src/protocol/TProtocol.py
@@ -19,7 +19,6 @@
from thrift.Thrift import TException, TType, TFrozenDict
from thrift.transport.TTransport import TTransportException
-from ..compat import binary_to_str, str_to_binary
import sys
from itertools import islice
@@ -117,13 +116,13 @@
pass
def writeString(self, str_val):
- self.writeBinary(str_to_binary(str_val))
+ self.writeBinary(bytes(str_val, 'utf-8'))
def writeBinary(self, str_val):
pass
def writeUtf8(self, str_val):
- self.writeString(str_val.encode('utf8'))
+ self.writeString(str_val.encode('utf-8'))
def readMessageBegin(self):
pass
@@ -180,13 +179,13 @@
pass
def readString(self):
- return binary_to_str(self.readBinary())
+ return self.readBinary().decode('utf-8')
def readBinary(self):
pass
def readUtf8(self):
- return self.readString().decode('utf8')
+ return self.readString().decode('utf-8')
def skip(self, ttype):
if ttype == TType.BOOL: