-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
addition/proposalNew features or enhancementsNew features or enhancementsneeds implementer interestMoving the issue forward requires implementers to express interestMoving the issue forward requires implementers to express interest
Description
This is a feature request. Apologies if this is the wrong forum.
My basic proposal is to add an optional second argument to atob and btoa, which would take an options bag allowing the developer to describe the binary encoding to use if the string contains non-ASCII bytes, as in:
btoa("🚀", { encoding: "utf-8" /* utf-8 or utf-16 for now */ })This would convert the string to UTF-8 and then encode those bytes, rather than throwing an InvalidCharacterError. Decoding would be similar:
atob("🚀", { encoding: "utf-8" })This would make these functions less bug-prone in practice, and better support non-English/multi-lingual use cases. It also seems like it could be a web-compatible change, given that it'd just be adding an argument.
juharris
Metadata
Metadata
Assignees
Labels
addition/proposalNew features or enhancementsNew features or enhancementsneeds implementer interestMoving the issue forward requires implementers to express interestMoving the issue forward requires implementers to express interest