Locales with scripts are not round-tripped properly

Description

Locales including scripts are not round-tripped properly by LocaleTypeDescriptor. An example of such a locale is “zh-Hant-HK”, which gets converted to a String as “zh_HK_#Hant” but read back as “zh-HK”.

LocaleTypeDescriptor.fromString builds the Locale instance uses the Locale constructor, which does not allow specifying a script or extension; alternatives would be to use Locale.forLanguageTag, or Locale.Builder.

Environment

None

Assignee

Unassigned

Reporter

Patrick Strawderman

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure