非ANSI文字をPerlでCrypt::Blowfishに処理する方法は?
次のスクリプトは文字セットUTF-8で記述されており、§
またはでのみ失敗しますö
。
#!/usr/bin/env perl
use strict;
use warnings FATAL => 'all';
use utf8;
use Crypt::Blowfish;
my $cipher = Crypt::Blowfish->new( pack 'H16', '12345678' );
my @chars = ( 'a', '§', 'ö', '9' );
printf( "%s: %s",
$_, ( eval { $cipher->encrypt( $_ x 8 ) } ) ? "ok\n" : "fail: $@" )
for ( @chars );