Question

The following program:

use Encode qw(:all);

my @list = Encode->encodings();
print join("\n", @list);

gives different results if I run script as .pl or as executable, created by pp.bat (ActiveState Perl is used) If I run a.exe, created by pp.bat the list of available encodings is very short. How do I add encodings?

Was it helpful?

Solution

You should add the modules directly in your code.

use Encode qw(:all);

use Encode::Byte;
use Encode::CN;
use Encode::JP;
use Encode::KR;
use Encode::TW;

my @list = Encode->encodings();
print join("\n", @list);

OTHER TIPS

Do perldoc Encode::Supported to figure out which module implements the encoding you want. Then tell pp to include that module, either by using the -M command-line option, or by adding the appropriate use statement to your script.

For example, if you need the iso-8859-15 encoding, that's provided by Encode::Byte. So you'd do pp.bat -M Encode::Byte script.pl, or add use Encode::Byte to script.pl.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top