UTF-8
UTF-8 is a variable-width encoding that represents every Unicode character as 1 to 4 bytes, and is byte-identical to ASCII for the first 128 characters.
The variable width is why 'byte count' and 'character count' differ: 'é' is 2 bytes, an emoji is 4. Code that slices strings by bytes will split characters in half and produce mojibake.
It is also why btoa() throws on non-ASCII text and why hashing a string requires encoding it to bytes first (TextEncoder) rather than passing the JavaScript string to a byte-oriented function.
UTF-8 is the default for JSON, HTML, and virtually all web APIs; the leftover problems come from systems that assumed Latin-1 or used the Windows code page.
Apply it: URL Encoder
URL encoder and decoder for percent-encoding: convert with encodeURIComponent, encodeURI, decodeURIComponent or decodeURI, and parse query strings.
Open the free URL Encoder →