Text Escaping and Unescaping in JavaScript with strutil

Today the package strutil came in handy, after receiving (*) this UTF-8 Quoted Printable text in my hands:

=?UTF-8?Q?Test_=F0=9F=91=BB?=

Thanks to strutil#unescapeFromMime() I was able to regain the original string:

Test 👻

Upon further investigation of strutil it turns out that this package is really powerful as it can do a truckload of things when it comes to encoding:

Text Escaping and Unescaping in JavaScript (UTF-8, UTF-16, UTF-32, dec, hex, punycode, mime, base64, and more)

strutil
jsescape demo →

(*) The encoding in the first place itself happened automatically by Amazon, whilst storing User-Defined Metadata on an S3 Object:

User-defined metadata is a set of key-value pairs. Amazon S3 stores user-defined metadata keys in lowercase. Each key-value pair must conform to US-ASCII when using REST and UTF-8 when using SOAP or browser-based uploads via POST.

Now you know 😉

Elsewhere , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *