- my @encodings_to_try = qw(utf8 iso8859-1);
- if ($version >= 3) {
- @encodings_to_try = qw(utf8);
- }
- for (@encodings_to_try) {
- last if is_utf8($line);
- my $temp;
- eval {
- $temp = decode("$_",$line,Encode::FB_CROAK);
- };
- if (not $@) { # only update the line if there are no errors.
- $line = $temp;
- last;
- }
- }