Louis-Philippe Véronneau pushed to branch master at lintian / lintian
Commits:
db373c08 by Louis-Philippe Véronneau at 2025-09-08T13:19:36+00:00
Try to decode font file using utf8 if it fails with cp1252.
- - - - -
1 changed file:
- lib/Lintian/Check/Fonts/Postscript/Type1.pm
Changes:
=====================================
lib/Lintian/Check/Fonts/Postscript/Type1.pm
=====================================
@@ -50,14 +50,24 @@ sub visit_installed_files {
my @command = ('t1disasm', $item->unpacked_path);
my $bytes = safe_qx(@command);
+ my $enc_warning = 'In file ' . $item->name . $COLON . $SPACE;
my $output;
try {
# iso-8859-1 works too, but the Font 1 standard could be older
$output = decode('cp1252', $bytes, Encode::FB_CROAK);
- } catch {
- die 'In file ' . $item->name . $COLON . $SPACE . $@;
+ } catch ($e) {
+ if ($e =~ m{^cp1252 "\\x81" does not map to Unicode at .+}) {
+ try {
+ # sometimes, the file is utf8
+ $output = decode('utf8', $bytes, Encode::FB_CROAK);
+ } catch {
+ die $enc_warning . $@;
+ }
+ } else {
+ die $enc_warning . $@;
+ }
}
my @lines = split(/\n/, $output);
View it on GitLab:
https://salsa.debian.org/lintian/lintian/-/commit/db373c08eb59c0ddaa4cbfed904a460396b21e80
--
View it on GitLab:
https://salsa.debian.org/lintian/lintian/-/commit/db373c08eb59c0ddaa4cbfed904a460396b21e80
You're receiving this email because of your account on salsa.debian.org.