Skip to content
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

buffer.transcode: document valid encodings #15632

Closed
kevinburke opened this issue Sep 26, 2017 · 3 comments
Closed

buffer.transcode: document valid encodings #15632

kevinburke opened this issue Sep 26, 2017 · 3 comments
Labels
buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations. encoding Issues and PRs related to the TextEncoder and TextDecoder APIs. i18n-api Issues and PRs related to the i18n implementation.

Comments

@kevinburke
Copy link

The documentation for buffer.transcode states:

Throws if the fromEnc or toEnc specify invalid character encodings or if conversion from fromEnc to toEnc is not permitted.

However, the documentation does not specify which encodings are valid.

(I was trying to transcode a Buffer into a Buffer with the same bytes, base64 encoded. My goal was to replace the + and / characters with - and _ without needing to create an entirely new string or call .replace).

@vsemozhetbyt vsemozhetbyt added buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations. i18n-api Issues and PRs related to the i18n implementation. encoding Issues and PRs related to the TextEncoder and TextDecoder APIs. labels Sep 26, 2017
@TimothyGu
Copy link
Member

There is a section in that document specifically about character encodings.

@kevinburke
Copy link
Author

kevinburke commented Sep 27, 2017

At least one character encoding specified there ('base64') is not valid for buffer.transcode; when you try to use it an error is thrown. It would be good to know if there are others without having to read the source code, or write demonstration code enumerating the possible encoding pairs.

@kevinburke
Copy link
Author

If you like I could rename this ticket "buffer.transcode should support base64" which would remove the confusion.

jasnell added a commit to jasnell/node that referenced this issue Aug 11, 2018
targos pushed a commit that referenced this issue Aug 12, 2018
Fixes: #15632

PR-URL: #22263
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations. encoding Issues and PRs related to the TextEncoder and TextDecoder APIs. i18n-api Issues and PRs related to the i18n implementation.
Projects
None yet
Development

No branches or pull requests

3 participants