Here's a test that I tried. The first two tests fail as they
should. The last 2 tests succeed.
#!/usr/bin/perl -l
BEGIN {
$| = 1;
$^W = 1;
$ENV{'TEST_VERBOSE'} = 1;
}
use strict;
use warnings;
use Test::utf8;
use Test::More tests => 4;
use Encode qw/:all/;
my $invalid = "\x{e9}";
Encode::_utf8_on($invalid);
ok(is_valid_string($invalid));
my ($buffer, $string) = ('', '');
while (read $invalid, $buffer, 256, length $string) {
$invalid .= decode(
'utf-8-strict', $buffer, Encode::FB_QUIET
);
}
Encode::_utf8_on($string);
ok(is_valid_string($string));
The
$buffer should hold any partial incrementation.