Locale languageTag anomaly

Jonathan Gibbons jonathan.gibbons at oracle.com
Thu Jun 7 21:19:23 UTC 2018


Regarding Locale.toLanguageTag, Locale.forLanguageTag

Should I be surprised (i.e. is it a bug) that out of 736 installed 
locales in a standard build of JDK, exactly 1 locale fails the following 
round-trip test:

     locale.equals(Locale.forLanguageTag(locale.toLanguageTag()))

The locale "no_NO_NY" comes back as "nn_NO".

Attached is a test program.  Here is the output from the test program:

$ /opt/jdk/1.9.0/bin/java -cp play/locales/classes Locales
test locale: no_NO_NY [no,NO,NY] nn-NO
      forLanguageTag: nn_NO
Tested 736 locales
Mismatch 1 locales

-- Jon


More information about the core-libs-dev mailing list