Skip to content

Feature/utf8 support #13

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

Merged
merged 5 commits into from
Jun 12, 2017
Merged

Feature/utf8 support #13

merged 5 commits into from
Jun 12, 2017

Conversation

jeskew
Copy link
Contributor

@jeskew jeskew commented May 27, 2017

This PR adds cross-platform UTF-8 support, since JS strings are UCS-2 but string-to-binary conversions always assume UTF-8 encoding in Node. Also, we want to support string-to-binary conversions and the reverse for all SDK users, not just those whose written languages are confined to the basic multilingual plane of UCS-2/UTF-16.

In node, this functionality is provided by the buffer module, and some browsers support a standard that defines globally available TextEncoder and TextDecoder objects. In other browsers and elsewhere, we have to handle the conversion manually (as is done by the V2 SDK via the buffer module).

@jeskew jeskew mentioned this pull request May 27, 2017
@jeskew jeskew requested review from awood45 and chrisradek May 30, 2017 17:26
@jeskew jeskew mentioned this pull request Jun 2, 2017
7 tasks
@@ -0,0 +1,65 @@
export function fromUtf8(input: string): Uint8Array {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this code taken from the Buffer module?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mostly cribbed from https://github.com/google/closure-library/blob/master/closure/goog/crypt/crypt.js#L110, though I modernized it a bit. I should include a mention of that in a comment.

@jeskew jeskew mentioned this pull request Jun 5, 2017
@jeskew jeskew merged commit 1d7afa1 into aws:master Jun 12, 2017
@jeskew jeskew deleted the feature/utf8-support branch June 15, 2017 17:43
@lock
Copy link

lock bot commented Sep 26, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants