Skip to content

feat: Add TextEncoder and TextDecoder - #2928

Closed
fguitton wants to merge 1 commit into
jsdom:masterfrom
fguitton:feature/textencoder-textdecoder
Closed

fguitton wants to merge 1 commit into
jsdom:masterfrom
fguitton:feature/textencoder-textdecoder

Conversation

@fguitton

Copy link
Copy Markdown

This aims at addressing the lack of TextEncoder and TextDecoder.
This PR relies on the Node native object when present and utilises text-encoding package for Node 10.

Closes #2524

@TimothyGu

Copy link
Copy Markdown
Member

Apologies for the lack of comment on that bug, but this should be done through the https://github.com/jsdom/whatwg-encoding package. Right now, whatwg-encoding only exposes some lower-level primitive, but it could be augmented to support TextEncoder and TextDecoder as well, much like whatwg-url (which has URL and URLSearchParams in addition to lower-level primitives).

You could take a look at https://github.com/jsdom/whatwg-url/blob/master/webidl2js-wrapper.js and https://github.com/jsdom/whatwg-url/blob/master/scripts/convert-idl.js for a recommended pattern of adding these classes there.

@fguitton

fguitton commented Mar 29, 2020 •

Copy link
Copy Markdown
Author

@TimothyGu Thank you for letting me know. I have started jsdom/whatwg-encoding#11 targeted at moving from the current structure to one which is more resembling that of whatwg-url.

As the whatwg-encoding repository suggests text-encoding should be used, but as it would turn out is not spec compliant (it is also archived read-only) and causes the test to break for Node 10. Would you be able to offer suggestions as to how to proceed ?

https://github.com/jsdom/whatwg-encoding/blob/04c383e309e0d3f198e19b050295995028b6cc48/README.md#L50

@TimothyGu

Copy link
Copy Markdown
Member

Thanks for doing that! Let's continue this conversation over at jsdom/whatwg-encoding#11 then. We could see about integrating that change in jsdom after that gets merged.

@TimothyGu TimothyGu closed this Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement TextEncoder and TextDecoder

2 participants