Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Removing TextString check to encode characters when writing bytes
This change removes extraneous code in the TextString primitive
that would conditionally encode the individual string characters
depending upon the version of Python being used. This code caused
errors when using Unicode strings in Python 2.7 and below.
  • Loading branch information
PeterHamilton committed Dec 6, 2016
commit 843df7d2b1fe27d11d4729936d27b7a59619bff6
6 changes: 1 addition & 5 deletions kmip/core/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,11 +810,7 @@ def read(self, istream):
def write_value(self, ostream):
# Write string to stream
for char in self.value:
if sys.version < '3':
c = char
else:
c = char.encode()
ostream.write(pack(self.BYTE_FORMAT, c))
ostream.write(pack(self.BYTE_FORMAT, char.encode()))

# Write padding to stream
for _ in range(self.padding_length):
Expand Down