From: Jeremias Maerki Date: Tue, 1 May 2007 09:41:05 +0000 (+0000) Subject: Bugzilla #41434: X-Git-Tag: fop-0_94~115 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=23ccb79d8212e968bffd97e64e0599e95bdf0cb6;p=xmlgraphics-fop.git Bugzilla #41434: Fix PDF Genaration for non-ASCII compatible locales. Submitted by: Martin Kögler git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@533986 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/pdf/PDFDocument.java b/src/java/org/apache/fop/pdf/PDFDocument.java index 29cb88731..00d6c8e08 100644 --- a/src/java/org/apache/fop/pdf/PDFDocument.java +++ b/src/java/org/apache/fop/pdf/PDFDocument.java @@ -934,7 +934,7 @@ public class PDFDocument { getProfile().verifyPDFVersion(); - byte[] pdf = ("%PDF-" + getPDFVersionString() + "\n").getBytes(); + byte[] pdf = encode("%PDF-" + getPDFVersionString() + "\n"); stream.write(pdf); this.position += pdf.length; @@ -955,9 +955,9 @@ public class PDFDocument { try { MessageDigest digest = MessageDigest.getInstance("MD5"); DateFormat df = new SimpleDateFormat("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'SSS"); - digest.update(df.format(new Date()).getBytes()); + digest.update(encode(df.format(new Date()))); //Ignoring the filename here for simplicity even though it's recommended by the PDF spec - digest.update(String.valueOf(this.position).getBytes()); + digest.update(encode(String.valueOf(this.position))); digest.update(getInfo().toPDF()); byte[] res = digest.digest(); String s = PDFText.toHex(res); diff --git a/src/java/org/apache/fop/pdf/PDFRectangle.java b/src/java/org/apache/fop/pdf/PDFRectangle.java index def6d9a2b..e84227adf 100644 --- a/src/java/org/apache/fop/pdf/PDFRectangle.java +++ b/src/java/org/apache/fop/pdf/PDFRectangle.java @@ -79,7 +79,7 @@ public class PDFRectangle { * @return the PDF */ public byte[] toPDF() { - return toPDFString().getBytes(); + return PDFDocument.encode(toPDFString()); } /** diff --git a/src/java/org/apache/fop/pdf/PDFStream.java b/src/java/org/apache/fop/pdf/PDFStream.java index ea7748576..2cc9a1b0a 100644 --- a/src/java/org/apache/fop/pdf/PDFStream.java +++ b/src/java/org/apache/fop/pdf/PDFStream.java @@ -57,7 +57,7 @@ public class PDFStream extends AbstractPDFStream { */ public void add(String s) { try { - data.getOutputStream().write(s.getBytes()); + data.getOutputStream().write(PDFDocument.encode(s)); } catch (IOException ex) { //TODO throw the exception and catch it elsewhere ex.printStackTrace(); diff --git a/status.xml b/status.xml index 1570630a3..37f0f53f9 100644 --- a/status.xml +++ b/status.xml @@ -28,6 +28,9 @@ + + Fix PDF Genaration for non-ASCII compatible locales. + Add support for the collapsing-border model in tables.