- or download this
sub is_utf8 {
utf8::upgrade( $_[0] );
return 1;
}
- or download this
sub is_utf8 {
my $s = "\x80" . $_[0];
my $internal = unpack "p", pack "p", $s;
return $s ne $internal;
}
- or download this
utf8::downgrade( my $empty_dn = '' ); # 0
utf8::upgrade( my $empty_up = '' ); # 1
...
) {
print is_utf8($_)?1:0, "\n";
}