use Test::More tests => 4; my $bin = join '', map chr, 0..255; utf8::downgrade $bin; # One internal format no bytes; is(substr($bin, 100, 5), "\x64\x65\x66\x67\x68", 'no bytes, UTF8=0'); use bytes; is(substr($bin, 100, 5), "\x64\x65\x66\x67\x68", 'use bytes, UTF8=0'); utf8::upgrade $bin; # Other internal format no bytes; is(substr($bin, 100, 5), "\x64\x65\x66\x67\x68", 'no bytes, UTF8=1'); use bytes; is(substr($bin, 100, 5), "\x64\x65\x66\x67\x68", 'use bytes, UTF8=1');