Skip to content

Commit 7805aae

Browse files
stevenmantonSteven Antonicywang86rui
authored
fix: encode localmode payload to UTF-8 (#2430)
Co-authored-by: Steven Anton <[email protected]> Co-authored-by: icywang86rui <[email protected]>
1 parent 9f399ce commit 7805aae

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/sagemaker/local/local_session.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,9 @@ def invoke_endpoint(
469469
if InferenceId is not None:
470470
headers["X-Amzn-SageMaker-Inference-Id"] = InferenceId
471471

472+
# The http client encodes all strings using latin-1, which is not what we want.
473+
if isinstance(Body, str):
474+
Body = Body.encode("utf-8")
472475
r = self.http.request("POST", url, body=Body, preload_content=False, headers=headers)
473476

474477
return {"Body": r, "ContentType": Accept}

0 commit comments

Comments
 (0)