Internationalization and localization tools


Locale-Sensitive Perl Method

$dst = POSIX::strxfrm( $src );

Internationalization (I18n) Method Overview

The POSIX::strxfrm function takes a string, $src, then maps a transformed version to $dst for use in char-by-char comparisons against other transformed strings during collation. This functionality occurs under the hood by locale affected string comparison operators such as cmp.

See perl's POSIX function documentation and perllocale for additional details.

I18n Issues

Since strxfrm is called under the hood, it should not be used directly within code. strxfrm does not handle null characters embedded in strings. It treats the first null character it reaches as an indicator that the string is finished. Transformed strings provided by strxfrm may not be portable across systems. Attempts to use this function directly may be motivated by performance concerns, but will not significantly speed up the application.

Suggested Replacement

Use the appropriate higher-level string comparison operator. Such as cmp, eq, gt etc.

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