Skip to content

Commit

Permalink
replace "utf8" alias by canonical "utf-8" locale code
Browse files Browse the repository at this point in the history
  • Loading branch information
a-detiste committed Feb 19, 2025
1 parent 5b1b25b commit c91fae9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/py/src/protocol/TBinaryProtocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def readMessageBegin(self):
if self.strictRead:
raise TProtocolException(type=TProtocolException.BAD_VERSION,
message='No protocol version header')
name = self.trans.readAll(sz).decode('utf8')
name = self.trans.readAll(sz).decode('utf-8')
type = self.readByte()
seqid = self.readI32()
return (name, type, seqid)
Expand Down
4 changes: 2 additions & 2 deletions lib/py/src/protocol/TCompactProtocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def writeMessageBegin(self, name, type, seqid):
if tseqid < 0:
tseqid = 2147483648 + (2147483648 + tseqid)
self.__writeVarint(tseqid)
self.__writeBinary(bytes(name, 'utf8'))
self.__writeBinary(bytes(name, 'utf-8'))
self.state = VALUE_WRITE

def writeMessageEnd(self):
Expand Down Expand Up @@ -344,7 +344,7 @@ def readMessageBegin(self):
# however the sequence is actually signed...
if seqid > 2147483647:
seqid = -2147483648 - (2147483648 - seqid)
name = self.__readBinary().decode('utf8')
name = self.__readBinary().decode('utf-8')
return (name, type, seqid)

def readMessageEnd(self):
Expand Down
2 changes: 1 addition & 1 deletion lib/py/src/protocol/TJSONProtocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def readJSONString(self, skipContext):
utf8_bytes = bytearray([ord(character)])
while ord(self.reader.peek()) >= 0x80:
utf8_bytes.append(ord(self.reader.read()))
character = utf8_bytes.decode('utf8')
character = utf8_bytes.decode('utf-8')
string.append(character)

if highSurrogate:
Expand Down
8 changes: 4 additions & 4 deletions lib/py/src/protocol/TProtocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ def writeDouble(self, dub):
pass

def writeString(self, str_val):
self.writeBinary(bytes(str_val, 'utf8'))
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
Expand Down Expand Up @@ -179,13 +179,13 @@ def readDouble(self):
pass

def readString(self):
return self.readBinary().decode('utf8')
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:
Expand Down

0 comments on commit c91fae9

Please sign in to comment.