@codepoints = map ord($_), split //, $s1;
$s2 = join '', map chr($_), @codepoints;
ok($s1 eq $s2);
ok(length($s1) == length($s2);
####
$s1 = "abc\x80";
$s2 = $s1; # currently SVf_UTF8 not set; string uses 4 bytes of storage
$s2 .= "\x{100}"; # currently perl upgrades to SVf_UTF8 and converts the 0x80 and 0x100 into multi-byte representations
chop($s2); # currently perl doesn't downgrade; the 0x80 codepoint still stored as 2 bytes
ok($s1 eq $s2);
ok(length($s1) == length($s2));
##
##
utf8::downgrade($s2); # the the 0x80 codepoint now stored as 1 byte
ok(length($s1) == $length($s2));
ok($s1 eq $s2);