Skip to content

Commit 00987a9

Browse files
authored
Merge pull request #779 from hxawax/main
2 parents 0fca639 + afe5b1c commit 00987a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

jupyter_client/session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ def json_packer(obj):
101101
default=json_default,
102102
ensure_ascii=False,
103103
allow_nan=False,
104-
).encode("utf8")
104+
).encode("utf8", errors="surrogateescape")
105105
except (TypeError, ValueError) as e:
106106
# Fallback to trying to clean the json before serializing
107107
packed = json.dumps(
108108
json_clean(obj),
109109
default=json_default,
110110
ensure_ascii=False,
111111
allow_nan=False,
112-
).encode("utf8")
112+
).encode("utf8", errors="surrogateescape")
113113

114114
warnings.warn(
115115
f"Message serialization failed with:\n{e}\n"

0 commit comments

Comments
 (0)