On modern GNU / Linux systems, you must completely switch to UTF-8 around the world. It means setting up
LANG="xx_YY.UTF-8" PERL_UNICODE=SDAL PERL5OPT=-Mutf8
in your /etc/environment or /etc/sysconfig/i18n or /etc/default/locale or whatever your system configuration file is. Due to a RHEL / Centos error, I designated /etc/environment before sysconfig/i18n .
Scripts that rely on binary input must set binmode to STDIN / OUT / ERR (?) Or use open pragma, or must be called with the -C0 option.
The problem is that some DBD drivers are erroneous, for example. DBD :: JDBC , and you must set the utf8 flag manually.
use Encode qw/_utf8_on/; map { _utf8_on $_; } @strings;
source share