Name: rlT66838 Date: 07/20/99
For Danish (da_DK) and Norwegian users (no_NO, no_NO_B), Java sorts improperly:
When sorting by catalog products' descriptions, v and w are treated as the same character (have the same weighting).
Example: 1. waffle
2. verkehrt
3. Victor
4. wood
5. vox
6. wrench
The correct result is to have v and w have different primary weightings. This desired behavior has been confirmed by a native Norwegian in our company.
//Get the Collator for no_NO (or da_DK or no_NO_B) and set its strength to
PRIMARY
Collator no_NO_Collator = Collator.getInstance(Locale.no_NO);
no_NO_Collator.setStrength(Collator.PRIMARY);
if( no_NO_Collator.compare("waffle", "vaffle") == 0 )
{
System.out.println("Strings are equivalent");
}
The (incorrect) result will be that the "Strings are equivalent". This is
the case for the locales: no_NO, no_NO_B, da_DK. This is the case for
Collator.PRIMARY and Collator.SECONDARY. The difference only shows up for
Collator.TERTIARY.
The correct answer is that for the letter "w" and "v", Collator.PRIMARY and
Collator.SECONDARY should be viewed as different characters. This is the
correct behavior in Danish, Norwegian, as described by our native Norwegian
employee.
(Review ID: 85477)
======================================================================