diff options
author | Jeremias Maerki <jeremias@apache.org> | 2007-05-01 09:41:05 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2007-05-01 09:41:05 +0000 |
commit | 23ccb79d8212e968bffd97e64e0599e95bdf0cb6 (patch) | |
tree | 7430e9544bd64574cecd0625b7194706ea47b13a /src | |
parent | 6309a4f57e2dd731c1db0844d2f8f4ff4a059468 (diff) | |
download | xmlgraphics-fop-23ccb79d8212e968bffd97e64e0599e95bdf0cb6.tar.gz xmlgraphics-fop-23ccb79d8212e968bffd97e64e0599e95bdf0cb6.zip |
Bugzilla #41434:
Fix PDF Genaration for non-ASCII compatible locales.
Submitted by: Martin Kögler <martin.koegler.at.brz.gv.at>
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@533986 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/pdf/PDFDocument.java | 6 | ||||
-rw-r--r-- | src/java/org/apache/fop/pdf/PDFRectangle.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/fop/pdf/PDFStream.java | 2 |
3 files changed, 5 insertions, 5 deletions
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(); |