locale - Java method setLanguageTag() accepts invalid region code -


the method setlanguagetag() of class locale.builder class validates locale. acceptable locale given in java doc .

the standard states valid locale has region of regex [a-za-z]{2} | [0-9]{3}. method validates language usa ( 3 characters )

i gave input locale en-usa , correctly validated. isn't bug in method should have thrown exception ?

[edit] mean en-usa valid locale ? mistaking usa other tag being region ? , reason why validating it.

so, went through code , found out there category extlang in locale , accepts 3 characters. accepts part after - extlang rather country. locale "en-usa" gets validated.


Comments