Skip to content

Commit

Permalink
Fix unicode error (#57)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander <post@alexanderfridiksson.com>
  • Loading branch information
AlexFrid and Alexander committed Apr 20, 2023
1 parent 7537ff8 commit db003c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions surrealdb/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ async def create(self, thing: str, data: Optional[Dict[str, Any]] = None) -> str
response = await self._request(
method="POST",
uri=f"/key/{table}/{record_id}" if record_id else f"/key/{table}",
data=json.dumps(data),
data=json.dumps(data, ensure_ascii=False),
)
if not response and record_id is not None:
raise SurrealException(f"Key {record_id} not found in table {table}")
Expand Down Expand Up @@ -276,7 +276,7 @@ async def update(self, thing: str, data: Any) -> Dict[str, Any]:
response = await self._request(
method="PUT",
uri=f"/key/{table}/{record_id}" if record_id else f"/key/{table}",
data=json.dumps(data),
data=json.dumps(data, ensure_ascii=False),
)
return response[0]['result']

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

Expand Down
2 changes: 1 addition & 1 deletion surrealdb/ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ async def _send(self, request: Request) -> None:
Exception: If the client is not connected to the Surreal server.
"""
self._validate_connection()
await self.ws.send(json.dumps(request.dict())) # type: ignore
await self.ws.send(json.dumps(request.dict(), ensure_ascii=False)) # type: ignore

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

0 comments on commit db003c6

Please sign in to comment.