From eb48728bc14e8f7694e5272e5d767c6b3d1925ef Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 11 Oct 2019 08:57:18 -0400 Subject: [PATCH] Have stringify replace by default This allows easier handling of invalid decode data. --- confluent_server/confluent/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/confluent_server/confluent/util.py b/confluent_server/confluent/util.py index 5cfafa3e..a44c5b96 100644 --- a/confluent_server/confluent/util.py +++ b/confluent_server/confluent/util.py @@ -31,7 +31,7 @@ def stringify(instr): # Normalize unicode and bytes to 'str', correcting for # current python version if isinstance(instr, bytes) and not isinstance(instr, str): - return instr.decode('utf-8') + return instr.decode('utf-8', errors='replace') elif not isinstance(instr, bytes) and not isinstance(instr, str): return instr.encode('utf-8') return instr