astitcher commented on code in PR #438: URL: https://github.com/apache/qpid-proton/pull/438#discussion_r1939570781
########## python/cproton.py: ########## @@ -204,12 +204,12 @@ def bytes2string(b, encoding='utf8'): return ffi.unpack(b.start, b.size).decode(encoding) -def py2bytes(py): +def py2bytes(py, encoding='utf8'): if isinstance(py, (bytes, bytearray, memoryview)): s = ffi.from_buffer(py) return len(s), s elif isinstance(py, str): - s = ffi.from_buffer(py.encode('utf8')) + s = ffi.from_buffer(py.encode(encoding)) return len(s), s Review Comment: Not entirely sure about this change - as it's only necessary because of the change below for round tripping. ########## python/cproton.py: ########## @@ -543,7 +543,7 @@ def pn_receiver(session, name): def pn_delivery(link, tag): - return lib.pn_delivery(link, py2bytes(tag)) + return lib.pn_delivery(link, py2bytes(tag, 'latin-1')) Review Comment: So this change makes sense from the point of view of round tripping the tags. But it is a change of behavior which will raise an exception for some input strings which would previously have been accepted (but with a different encoding). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org