File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -174,3 +174,27 @@ def __init__(self):
174174 obj = SlotClass ()
175175 serializer = EventSerializer ()
176176 assert json .loads (serializer .encode (obj )) == {"field" : "value" }
177+
178+
179+ def test_non_ascii_characters_not_escaped ():
180+ """Test that non-ASCII characters are serialized directly without \\ uXXXX escaping."""
181+ data = {
182+ "chinese" : "你好世界" ,
183+ "japanese" : "こんにちは" ,
184+ "korean" : "안녕하세요" ,
185+ "emoji" : "🎉" ,
186+ }
187+
188+ result = json .dumps (data , cls = EventSerializer , ensure_ascii = False )
189+
190+ # Verify non-ASCII characters appear directly in output
191+ assert "你好世界" in result
192+ assert "こんにちは" in result
193+ assert "안녕하세요" in result
194+ assert "🎉" in result
195+
196+ # Verify no unicode escape sequences
197+ assert "\\ u" not in result
198+
199+ # Verify JSON is still valid
200+ assert json .loads (result ) == data
You can’t perform that action at this time.
0 commit comments