You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IE11 and EdgeHTML do not have support for the TextEncoder.prototype.encode and TextDecoder.prototype.decode apis. Native implementations of TextEncoder must only encode to UTF-8 but TextDecoder may support other encodings, however it is imo rare to use any other in practice given it's not reversible, so it would be sufficient to throw a RangeError when constructing a TextDecoder for any other encoding.
My use case for this polyfill is in combination with websockets. Websockets support a text and binary mode, and I would like to use this api to decode strings transmitted within the binary data (when aWebSocket.binaryType is set to arraybuffer), as well as send encoded strings back to the server.
What
Add a polyfill for TextEncoder and TextDecoder capable of encoding and decoding UTF-8.
Details
IE11 and EdgeHTML do not have support for the
TextEncoder.prototype.encode
andTextDecoder.prototype.decode
apis. Native implementations of TextEncoder must only encode to UTF-8 but TextDecoder may support other encodings, however it is imo rare to use any other in practice given it's not reversible, so it would be sufficient to throw a RangeError when constructing a TextDecoder for any other encoding.My use case for this polyfill is in combination with websockets. Websockets support a text and binary mode, and I would like to use this api to decode strings transmitted within the binary data (when
aWebSocket.binaryType
is set toarraybuffer
), as well as send encoded strings back to the server.Additional Information
MDN has a working polyfill for TextEncoder but not for TextDecoder. I submitted a request to that repo but was directed here instead: mdn/sprints#1508.
The text was updated successfully, but these errors were encountered: