<div dir="ltr">Hi all,<br><br>I'd like to propose the addition of a new object-oriented abstraction for representing full Unicode characters in Java: `UnicodeCharacter`.<br><br>This class addresses a fundamental limitation of the current `Character` type, which wraps a single `char` and therefore cannot properly represent Unicode characters outside the Basic Multilingual Plane (BMP). With the growing importance of supplementary characters (e.g., emoji, non-Latin scripts, rare CJK glyphs), a more complete and object-oriented Unicode abstraction would be beneficial to the JDK.<br><br>### Motivation<br><br>The `Character` type is limited to 16-bit `char` units, and cannot represent characters requiring surrogate pairs (code points > U+FFFF). Java developers working with text must often deal with `codePointAt`, `toChars`, and `offsetByCodePoints`, resulting in fragile and error-prone code. Furthermore, there's no immutable object type that cleanly encapsulates a single logical Unicode character.<br><br>### Proposed Class: UnicodeCharacter<br><br>This proposal introduces a final, immutable class that wraps a valid Unicode code point and exposes convenient methods to work with it.<br><br>A reference implementation is available here:<br><a href="https://github.com/pponec/ujorm/blob/master/project-m2/ujo-tools/src/main/java/org/ujorm/tools/common/UnicodeCharacter.java">https://github.com/pponec/ujorm/blob/master/project-m2/ujo-tools/src/main/java/org/ujorm/tools/common/UnicodeCharacter.java</a><br><br>Highlights:<br><br>```java<br>public final class UnicodeCharacter implements CharSequence, Comparable<UnicodeCharacter> {<br><br>    public static UnicodeCharacter of(final int codePoint);<br>    public static UnicodeCharacter of(final CharSequence text, final int unicodeIndex);<br><br>    public int codePoint();<br>    public char[] toChars();<br>    public int charCount();<br>    public boolean equals(char c);<br><br>    @Override<br>    public String toString();<br>    @Override<br>    public int length();<br>    @Override<br>    public char charAt(int index);<br>    @Override<br>    public CharSequence subSequence(int start, int end);<br>}<br>Benefits<br>Proper support for the full Unicode range, including supplementary characters.<br><br>Immutable and type-safe object model.<br><br>Simpler and safer text iteration and processing.<br><br>Aligns well with modern Java idioms, e.g. Stream<UnicodeCharacter> from a String.<br><br>Object-oriented alternative to repeated Character.toChars(...), codePointAt(...), etc.<br><br>Compatibility<br>The proposed class is entirely new and doesn't break any existing APIs. It complements existing types and uses only standard Java APIs. It can be introduced in the java.lang or java.text package without VM-level changes.<br><br>Adoption<br>This type can be used by libraries, UI frameworks, editors, and any text-processing tools where proper Unicode character semantics are critical. It promotes correctness in multilingual and emoji-rich applications.<br><br>Please let me know if there's interest. I'm happy to further develop this idea into a JEP if the community agrees it's worth exploring.<br><br>Best regards,<br>Pavel Ponec<br><br><a href="mailto:pponec@gmail.com">pponec@gmail.com</a><br></div>