From 8e41be96730a3637fa34e2f98a6391ecbdf6fe2f Mon Sep 17 00:00:00 2001 From: "Flavio S. Glock" Date: Fri, 15 May 2026 13:17:45 +0200 Subject: [PATCH] fix: MIME::QuotedPrint skips QP soft breaks when EOL is empty Perl encode_qp($str, '') disables quoted-printable line wrapping while still encoding non-printables. Data::ICal relies on this for QUOTED-PRINTABLE properties; mid-string '= splits corrupted syncml and failed jcpan -t Data::ICal. Generated with [Cursor](https://cursor.com/docs) Co-Authored-By: Cursor Co-authored-by: Cursor --- .../org/perlonjava/runtime/perlmodule/MIMEQuotedPrint.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/perlonjava/runtime/perlmodule/MIMEQuotedPrint.java b/src/main/java/org/perlonjava/runtime/perlmodule/MIMEQuotedPrint.java index 800a76397..42d9a5b7e 100644 --- a/src/main/java/org/perlonjava/runtime/perlmodule/MIMEQuotedPrint.java +++ b/src/main/java/org/perlonjava/runtime/perlmodule/MIMEQuotedPrint.java @@ -110,7 +110,8 @@ private static String encodeQuotedPrintable(String input, String eol, boolean bi // Check if adding this token would make the line too long // We need to leave room for the '=' of a soft break, so max is 75 - if (currentLength + token.length() > 75) { + // Empty EOL means Perl's "no soft breaks" mode (binary charset encoding only). + if (!eol.isEmpty() && currentLength + token.length() > 75) { // Need to break the line output.append(currentLine).append("=").append(eol); currentLine = new StringBuilder(token);