Skip to content

Instantly share code, notes, and snippets.

@hitobashira
Created August 19, 2018 02:58
Show Gist options
  • Save hitobashira/e58b969335f125f059cac0a9a171091a to your computer and use it in GitHub Desktop.
Save hitobashira/e58b969335f125f059cac0a9a171091a to your computer and use it in GitHub Desktop.
perl5 utf-8 test script
#!/usr/bin/perl -w -C64
#
# locale ja.JP.UTF-8
use strict;
use v5.26;
# use utf8;
use locale;
use utf8::all;
use Cwd 'getcwd';#
#use Encode 'decode';
BEGIN{ utf8::decode($0);}
my $CURDIR = getcwd ;
say "カレント(current dir) $CURDIR" ; #NG
utf8::decode($CURDIR);
say "カレント(current dir) $CURDIR" ;
#####################################
say "$0";
my $日本語 = "日本語の変数" ;
say "$日本語" ; #OK
say "@ARGV"; #OK
say "\$0 スクリプト(scriptname) $0";
sub Cwd8 {
# $cwdutf8= @_;
use Cwd 'getcwd';
my $cwdutf8 = getcwd ;
utf8::decode($cwdutf8);
my $CWD8;
$CWD8 = $cwdutf8;
say "sub routine Cwd8:: in $CWD8"; #OK
}
Cwd8;
__END__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment