1#!perl 2 3BEGIN { 4 chdir 't' if -d 't'; 5 @INC = '../lib'; 6 require './test.pl'; 7} 8 9plan tests => 4; 10 11use strict; 12 13my $str = "\x{99f1}\x{99dd}"; # "camel" in Japanese kanji 14$str =~ /(.)/; 15 16ok utf8::is_utf8($1), "is_utf8(unistr)"; 17scalar "$1"; # invoke SvGETMAGIC 18ok utf8::is_utf8($1), "is_utf8(unistr)"; 19 20utf8::encode($str); # off the utf8 flag 21$str =~ /(.)/; 22 23ok !utf8::is_utf8($1), "is_utf8(bytes)"; 24scalar "$1"; # invoke SvGETMAGIC 25ok !utf8::is_utf8($1), "is_utf8(bytes)"; 26