fix: utf-16 json encoder support (#28486)

Co-authored-by: Eyal Ezer <eyal.ezer@ge.com>
This commit is contained in:
Eyal Ezer
2024-05-15 10:53:19 -05:00
committed by GitHub
parent f420005b57
commit 5f714b707c
4 changed files with 31 additions and 8 deletions

View File

@@ -482,7 +482,10 @@ def base_json_conv(obj: Any) -> Any:
try:
return obj.decode("utf-8")
except Exception: # pylint: disable=broad-except
return "[bytes]"
try:
return obj.decode("utf-16")
except Exception: # pylint: disable=broad-except
return "[bytes]"
raise TypeError(f"Unserializable object {obj} of type {type(obj)}")