UTF-16
A Unicode encoding that stores each character as one or two 16-bit code units, used in memory by Java and JavaScript strings and by Windows.
In more detail
UTF stands for Unicode Transformation Format; the number is the size of each unit in bits. Most everyday characters take one unit, but characters beyond the first 65,536 take a pair of units called a surrogate pair.
Examples
Java stores String and char in memory as UTF-16 code units.In UTF-16LE, plain English text looks like ASCII with a zero byte after each character.Related terms
- char — Java's primitive type holding one UTF-16 code unit, which covers most but not all single characters.
- UTF-8 — The most widely used character encoding, which can represent every Unicode character and matches ASCII for plain English letters.
- Unicode — The standard that gives every character in every writing system its own number, called a code point.
- ASCII — An old character encoding covering 128 characters: English letters, digits, punctuation and control codes.
- YARA string — A named pattern in a YARA rule's strings section, written as text or hexadecimal bytes, with modifiers that change how it matches.
- strings command — Pulling readable text out of a binary file, such as addresses, file paths, registry keys and error messages.
- endianness — The order in which the bytes of a multi-byte number are stored: most significant first (big-endian) or least significant first (little-endian).
Taught in
- Primitive And Reference Types — Modern Java: Virtual Threads & High-Throughput Services
- Fundamentals Sprint: Nine Calls On The Server — Prometheus Certified Associate (PCA) Exam Prep
- YARA Rule Authoring & File Signature Matching — Security Operations & Threat Hunting (SOC)
References
- RFC 2781: UTF-16, an encoding of ISO 10646
- Unicode FAQ: UTF-8, UTF-16, UTF-32 and BOM
- Java Tutorials: Unicode