Skip to content

LambdaMarshaller encodes unicode characters as unicode escape sequences #87

Closed
@mdsakalu

Description

@mdsakalu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions