---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 8 Edition"
java_version: 8
chapter: "Chapter 3. Lexical Structure"
section: "3.1"
heading: "3.1. Unicode"
parent: "Chapter 3. Lexical Structure"
source: https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.1
id: "3.1"
url: https://jvm.obfuscated.software/jls/se8/3.1.html
raw: https://jvm.obfuscated.software/jls/se8/3.1.md
---

# 3.1. Unicode

Programs are written using the Unicode character set. Information about this character set and its associated character encodings may be found at `http://www.unicode.org/`.

The Java SE platform tracks the Unicode Standard as it evolves. The precise version of Unicode used by a given release is specified in the documentation of the class `Character`.

Versions of the Java programming language prior to JDK 1.1 used Unicode 1.1.5. Upgrades to newer versions of the Unicode Standard occurred in JDK 1.1 (to Unicode 2.0), JDK 1.1.7 (to Unicode 2.1), Java SE 1.4 (to Unicode 3.0), Java SE 5.0 (to Unicode 4.0), Java SE 7 (to Unicode 6.0), and Java SE 8 (to Unicode 6.2).

The Unicode standard was originally designed as a fixed-width 16-bit character encoding. It has since been changed to allow for characters whose representation requires more than 16 bits. The range of legal code points is now U+0000 to U+10FFFF, using the hexadecimal *U+n notation*. Characters whose code points are greater than U+FFFF are called supplementary characters. To represent the complete range of characters using only 16-bit units, the Unicode standard defines an encoding called UTF-16. In this encoding, supplementary characters are represented as pairs of 16-bit code units, the first from the high-surrogates range, (U+D800 to U+DBFF), the second from the low-surrogates range (U+DC00 to U+DFFF). For characters in the range U+0000 to U+FFFF, the values of code points and UTF-16 code units are the same.

The Java programming language represents text in sequences of 16-bit code units, using the UTF-16 encoding.

Some APIs of the Java SE platform, primarily in the `Character` class, use 32-bit integers to represent code points as individual entities. The Java SE platform provides methods to convert between 16-bit and 32-bit representations.

This specification uses the terms *code point* and *UTF-16 code unit* where the representation is relevant, and the generic term *character* where the representation is irrelevant to the discussion.

Except for comments ([§3.7](3.7.md)), identifiers, and the contents of character and string literals ([§3.10.4](3.10.4.md), [§3.10.5](3.10.5.md)), all input elements ([§3.5](3.5.md)) in a program are formed only from ASCII characters (or Unicode escapes ([§3.3](3.3.md)) which result in ASCII characters).

ASCII (ANSI X3.4) is the American Standard Code for Information Interchange. The first 128 characters of the Unicode UTF-16 encoding are the ASCII characters.
