native_is_utf8#
Return true if the scalar carries the SVf_UTF8 flag.
Synopsis#
my $flagged = is_utf8($string);
my $flagged = is_utf8($string, $check);
With one argument, is_utf8 reports the flag as-is. With a true
$check, the bytes are also validated as UTF-8; a flagged scalar
whose bytes are not valid UTF-8 returns false.
This is a low-level diagnostic. Regular Perl code should not need
it — the flag is an internal implementation detail, and the
right place to think about “is this text” is at I/O boundaries
with encode/decode.
Differences from upstream#
Fully compatible with upstream. Covered by
t/81-xs-native/Encode/080-utf8-flags.t.