deri pushed a commit to branch master
in repository groff.
commit e097f6abb4e517817dcb7f8a8fca53945fa22ac5
Author: Deri James <[email protected]>
AuthorDate: Mon May 25 16:02:40 2026 +0100
Handle URI encoded characters (%nn) correctly.
* src/devices/gropdf/gropdf.pl (LoadPDF): A '%' is used
to introduce a comment in a PDF, but it may also be used
to hex encode a character in a URI of an external link. Page
620 of the PDF 1.7 standard has a NOTE about this. Fix it.
---
ChangeLog | 9 +++++++++
src/devices/gropdf/gropdf.pl | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index ba03304c6..a3891e0a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2026-05-25 Deri James <[email protected]>
+
+ Handle URI encoded characters (%nn) correctly.
+
+ * src/devices/gropdf/gropdf.pl (LoadPDF): A '%' is used
+ to introduce a comment in a PDF, but it may also be used
+ to hex encode a character in a URI of an external link. Page
+ 620 of the PDF 1.7 standard has a NOTE about this. Fix it.
+
2026-05-24 G. Branden Robinson <[email protected]>
When building outside of the source tree and with the configure
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 3658cc649..fb8045900 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -2540,6 +2540,7 @@ sub LoadPDF
}
}
+ s/%([A-Fa-f0-9]{2})/chr(hex($1))/ge;
s/%.*?$//;
$pdftxt.=$_.' ';
}
@@ -2581,7 +2582,6 @@ sub LoadPDF
LoadStream($pdf->[$ObjStm],$pdf);
my $pos=$pdf->[$ObjStm]->{OBJ}->{First};
my $s=$pdf->[$ObjStm]->{STREAM};
- $s=~s/\%.*?$//m;
my @o=split(' ',substr($s,0,$pos));
substr($s,0,$pos)='';
push(@o,-1,length($s));
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit