- or download this
#!/usr/bin/perl
...
my $text = "\xC9ric";
say looks_like_cp1252($text) ?1:0; # 0
- or download this
my $txt;
if (is_valid_utf8($text)) {
...
} else {
$txt = decode('Windows-1252', $bytes);
}
- or download this
my $bytes = '...';
my $txt;
...
}) {
$txt = decode('Windows-1252', $bytes);
}