use strict;
use utf8;
use Getopt::Long;
-use Encode qw(encode decode);
+use Encode::Locale ('decode_argv');
+use Encode ('encode', 'decode');
###PERL_LIB: use lib '/botm/lib/post';
use botm_common (
'make_temp_path'
);
-###PERL_ENCODING_FILE_IN: use constant ENCODING_FILE_IN => 'UTF-8';
-###PERL_ENCODING_FILE_OUT: use constant ENCODING_FILE_OUT => 'utf8';
-###PERL_ENCODING_STD_IN: use constant ENCODING_STD_IN => 'UTF-8';
-###PERL_ENCODING_STD_OUT: use constant ENCODING_STD_OUT => 'utf8';
+###PERL_ENCODING_FILE: use constant ENCODING_FILE => 'UTF-8';
###PERL_DEFAULT_PASSWORD: use constant DEFAULT_PASSWORD => 'password';
###PERL_DEFAULT_SUBJECT: use constant DEFAULT_SUBJECT => 'Re: 1190: "Time"';
"\n".
" -h, --help\n";
-binmode STDIN, ':encoding('.ENCODING_STD_IN.')';
-# binmode ARGV, ':encoding('.ENCODING_STD_IN.')'; # not working
-binmode STDOUT, ':encoding('.ENCODING_STD_OUT.')';
-binmode STDERR, ':encoding('.ENCODING_STD_OUT.')';
+binmode STDIN, ':encoding(console_in)';
+binmode STDOUT, ':encoding(console_out)';
+binmode STDERR, ':encoding(console_out)';
+decode_argv();
my %options = {};
-foreach my $arg (@ARGV) {
- $arg = decode(ENCODING_STD_IN, $arg);
-}
-
Getopt::Long::Configure('bundling');
GetOptions (
'username|l=s' => \$options{'username'},
foreach my $arg (@ARGV) {
# print "\nFILE $arg\n";
- my %data = read_data_file($arg, ENCODING_FILE_IN, $options{'data-only'});
+ my %data = read_data_file($arg, ENCODING_FILE, $options{'data-only'});
# foreach my $ind (keys %data) {
# print $ind.'='.$data{$ind}."\n";
# }
PERL_DEFAULT_PASSWORD = @_PERL_CONSTANT_STR( DEFAULT_PASSWORD , $default_password)
PERL_DEFAULT_SUBJECT = @_PERL_CONSTANT_STR( DEFAULT_SUBJECT , $default_subject)
PERL_DEFAULT_USERNAME = @_PERL_CONSTANT_STR( DEFAULT_USERNAME , $default_username)
-PERL_ENCODING_FILE_IN = @_PERL_CONSTANT_STR( ENCODING_FILE_IN , $encoding_file_in)
-PERL_ENCODING_FILE_OUT = @_PERL_CONSTANT_STR( ENCODING_FILE_OUT, $encoding_file_out)
-PERL_ENCODING_STD_IN = @_PERL_CONSTANT_STR( ENCODING_STD_IN , $encoding_std_in)
-PERL_ENCODING_STD_OUT = @_PERL_CONSTANT_STR( ENCODING_STD_OUT , $encoding_std_out)
+PERL_ENCODING_FILE = @_PERL_CONSTANT_STR( ENCODING_FILE , $encoding_file)
PERL_MIRROR_URL = @_PERL_CONSTANT_STR( MIRROR_URL , $mirror_url)
PERL_TMP_PATH = @_PERL_CONSTANT_STR( TMP_PATH , $tmp_path)