Internationalization and localization tools


Locale-Sensitive Perl Method

"a" cmp "b";
cmp();

Internationalization (I18n) Method Overview

The cmp operator returns -1, 0, or 1 value, based on whether the left argument is stringwise less than, equal to, or greater than the right argument.

See perlop and perllocale for additional details.

I18n Issues

cmp respects the current LC_COLLATE value as set for the current locale. However, cmp will also perform a bit-by-bit comparison. In some cases, characters with different bit values will be recognized as the same for a given locale. cmp will still see these as different, while eq will regard them as the same.

Suggested Replacement

If bit-by-bit comparison is not desired, use POSIX::strcoll

Globalyzer will detect this function and report it as an i18n issue. If you have determined that the call is being handled correctly, you can use Globalyzer's Ignore Comment functionality to ensure that it isn't picked up in a subsequent scan.



Locale-Sensitive Perl Methods

 

Lingoport internationalization and localization services and software