LinusU / encode-utf8

Turn a string into an ArrayBuffer by using the UTF8 encoding
MIT License
11 stars 3 forks source link

just use TextEncoder? #7

Open jimmywarting opened 2 years ago

jimmywarting commented 2 years ago

TextEncoder is globally avalible in all env...

new TextEncoder().encode('🐵 🙈 🙉 🙊').buffer
// => ArrayBuffer { byteLength: 19 }
LinusU commented 2 years ago

Unfortunately it isn't available in react-native, and this package is e.g. being used by a qr code generator used in that environment...

Potentially it would be better to direct those users to use a polyfill for react-native though 🤔