Skip to content

LambdaMarshaller encodes unicode characters as unicode escape sequences #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mdsakalu opened this issue Oct 11, 2022 · 0 comments · Fixed by #88
Closed

LambdaMarshaller encodes unicode characters as unicode escape sequences #87

mdsakalu opened this issue Oct 11, 2022 · 0 comments · Fixed by #88

Comments

@mdsakalu
Copy link
Contributor

The json encoder in LambdaMarshaller.marshall_response turns unicode characters into unicode escape sequences (i.e. \u0123) instead of regular unicode characters.

return self.jsonEncoder.encode(response), "application/json"

As a result, a unicode character contributes 6 bytes to the response size of the lambda instead of 2 bytes like a normal unicode character. The runtime interface clients for other languages (Ruby and NodeJS) do not produce unicode escape sequences. In the hypothetical case of a lambda that returns all unicode characters, a Ruby or NodeJS lambda function could return 3x as much data as a Python lambda function.

https://github.com/aws/aws-lambda-ruby-runtime-interface-client/blob/bbb95b2563344cef651828bd19e72de091d9a470/lib/aws_lambda_ric/aws_lambda_marshaller.rb#L32

https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/blob/9591537e98806494617281a362dbdc33b3853680/src/RuntimeClient/RuntimeClient.ts#L243

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant