For simple UTF-8 encoding, with slightly better compatibility than TextEncoder
, Blob does the trick. Won't work in very old browsers though.
new Blob(["😀"]).size; // -> 4
For simple UTF-8 encoding, with slightly better compatibility than TextEncoder
, Blob does the trick. Won't work in very old browsers though.
new Blob(["😀"]).size; // -> 4