Skip to content

Commit db003c6

Browse files
AlexFridAlexander
andauthored
Fix unicode error (#57)
Co-authored-by: Alexander <post@alexanderfridiksson.com>
1 parent 7537ff8 commit db003c6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

surrealdb/http.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ async def create(self, thing: str, data: Optional[Dict[str, Any]] = None) -> str
239239
response = await self._request(
240240
method="POST",
241241
uri=f"/key/{table}/{record_id}" if record_id else f"/key/{table}",
242-
data=json.dumps(data),
242+
data=json.dumps(data, ensure_ascii=False),
243243
)
244244
if not response and record_id is not None:
245245
raise SurrealException(f"Key {record_id} not found in table {table}")
@@ -276,7 +276,7 @@ async def update(self, thing: str, data: Any) -> Dict[str, Any]:
276276
response = await self._request(
277277
method="PUT",
278278
uri=f"/key/{table}/{record_id}" if record_id else f"/key/{table}",
279-
data=json.dumps(data),
279+
data=json.dumps(data, ensure_ascii=False),
280280
)
281281
return response[0]['result']
282282

@@ -309,7 +309,7 @@ async def patch(self, thing: str, data: Any) -> Dict[str, Any]:
309309
response = await self._request(
310310
method="PATCH",
311311
uri=f"/key/{table}/{record_id}" if record_id else f"/key/{table}",
312-
data=json.dumps(data),
312+
data=json.dumps(data, ensure_ascii=False),
313313
)
314314
return response[0]['result']
315315

surrealdb/ws.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ async def _send(self, request: Request) -> None:
715715
Exception: If the client is not connected to the Surreal server.
716716
"""
717717
self._validate_connection()
718-
await self.ws.send(json.dumps(request.dict())) # type: ignore
718+
await self.ws.send(json.dumps(request.dict(), ensure_ascii=False)) # type: ignore
719719

720720
async def _recv(self) -> Union[ResponseSuccess, ResponseError]:
721721
"""Receives a response from the Surreal server.

0 commit comments

Comments
 (0)