For Perl, do not use the cmp operator. Instead, you should use the Unicode::Collate :
use Unicode::Collate; sub compare_strs { my ( $str1, $str2 ) = @_;
If you are concerned about normalization (for example, the order in which the labels are combined), you can also use the Unicode::Normalize module.
In Java, use the Collator class, as described in the string comparison guide . For normalization, see the text normalization tutorial . The required classes were introduced in Java 1.6; if you need to support earlier versions of Java, you will need to use something like ICU libraries .
Using appropriate tools, as described above, should ensure that both environments behave according to the Unicode sorting algorithm (and therefore are compatible with each other).
source share