3 ms·
> There's nothing stopping us from packing UTF-8 bytes into a UTF-16 string: to use each of the two bytes to store one UTF-8 character. We would need custom enc
by zengid 9y ago
> There's nothing stopping us from packing UTF-8 bytes into a UTF-16 string: to use each of the two bytes to store one UTF-8 character. We would need custom encoders and decoders, but it's possible. And it would avoid the need to re-encode the string at any system boundary.
I'm guessing you'd have to write a C++ module for this, but any suggestions on how one might do this successfully?
- kevinburke 9y agoYou could use JavaScript, bit shifting and codePointAt, I think, but it would be a huge pain.
- pwdisswordfish 9y agoThat's completely bogus. Forget unpaired surrogates; this scheme cannot even represent odd-length ASCII strings.