A well-tested UTF-8 encoder/decoder written in JavaScript.
charsetencodingunicodeutf8
https://mths.be/utf8js