Internationalization Enhancements in Java SE 7

The Internationalization enhancements for Java SE 7 include the following:

New Scripts and Characters from Unicode 6.0.0

Early versions of the Java SE 7 release added support for Unicode 5.1.0. The final version of the Java SE 7 release supports Unicode 6.0.0. Unicode 6.0.0 is a major version of the Unicode Standard and adds support for over 2000 additional characters, as well as support for properties and data files.

The Java Tutorial has a new section that discusses Unicode.

Extensible Support for ISO 4217 Currency Codes

Currencies are identified by their ISO 4217 codes. These codes maintained by an external agency and are released independent of the Java SE platform. As of Java SE 7, it is possible to accommodate new currencies without requiring a new release of the JDK.

To supersede the default currency at runtime, create a properties file named <JAVA_HOME>/lib/ This file contains the key/value pairs of the ISO 3166 country code, and the ISO 4217 currency data. The value part consists of three comma-separated ISO 4217 currency values: an alphabetic code, a numeric code, and a minor unit. Any lines beginning with the hash character, #, are treated as comment lines. For example:

# Sample currency property for Japan

The new API for this feature includes the following methods, all in the Currency class:

Category Locale Support

The default locale can be independently set for two types of uses: the format setting is used for formatting resources, and the display setting is used in menus and dialogs. The new getDefault(Locale.Category) method takes a Locale.Category parameter. Passing the FORMAT enum to the method returns the default locale for formatting resources. Similarly, passing the DISPLAY enum returns the default locale used by the UI. The setDefault(Locale.Category, Locale) method is used to set the locale for the specified category. The no-argument getDefault method returns the DISPLAY default value.

On Microsoft Windows, these default values are initialized according to the "Standard and Formats" and "Display Language" settings in the Windows control panel.

Locale Class Supports BCP47 and UTR35

The Locale class has been updated to implement identifiers interchangeable with BCP 47 (IETF BCP 47, "Tags for Identifying Languages"), with support for the LDML (UTS#35, "Unicode Locale Data Markup Language") BCP 47-compatible extensions for locale data exchange.

The following nested classes have been added to the Locale class in this release:

The following methods have been added to the Locale class:

The following constants have been added to the LOCALE class:

For more information, see the Creating a Locale and BCP 47 Extensions lessons in the Java Tutorial.

New NumericShaper Methods

The NumericShaper class is used to convert Latin-1 (European) digits to other Unicode decimal digits. For the Java SE 7 release, the NumericShaper.Range enum has been added to represent a Unicode range of a script having its own decimal digits. The following methods, using the NumericShaper.Range enum have been added to the Java SE 7 release:

For more information, see the Converting Latin Digits to Other Unicode Digits lesson in the Java Tutorial.

Unicode 6.0 Support in Regular Expressions API

The Regular Expressions pattern matching functionality has been expanded to support Unicode 6.0. You can match Unicode code points using either the \u or the \x escape sequence.

The Unicode Support page in the Java Tutorial has more information.

Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.