Skip to content

Commit

Permalink
more python3 string fixes: only convert to bytes when needed
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@6183 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Apr 27, 2014
1 parent 9f3a07a commit a62082e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/xpra/net/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def lz4_compress(packet, level):
long = int #@ReservedAssignment
unicode = str #@ReservedAssignment
def zcompress(packet, level):
return level + ZLIB_FLAG, compress(bytes(packet, 'UTF-8'), level)
if type(packet)!=bytes:
packet = bytes(packet, 'UTF-8')
return level + ZLIB_FLAG, compress(packet, level)
else:
def zcompress(packet, level):
return level + ZLIB_FLAG, compress(str(packet), level)
Expand Down

0 comments on commit a62082e

Please sign in to comment.