Courses / JavaScript
91. Binary and Text Encodings (UTF-8 basics)
Understanding character encodings and handling binary/text data correctly.
JavaScript
Binary and Text Encodings (UTF-8 basics)
How text characters map to bytes so programs can store and transmit human-readable text correctly.
"I saved a string to a file and later it was full of weird symbols — what's going on?"
UTF-8 is a way to encode every Unicode character as one or more bytes; some characters use 1 byte, others use 2, 3, or 4 bytes. Correctly converting between strings and byte arrays prevents corrupted text when reading, writing, or sending data.
"I saved a string to a file and later it was full of weird symbols — what's going on?"
UTF-8 is a way to encode every Unicode character as one or more bytes; some characters use 1 byte, others use 2, 3, or 4 bytes. Correctly converting between strings and byte arrays prevents corrupted text when reading, writing, or sending data.