]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Bugzilla #41434:
authorJeremias Maerki <jeremias@apache.org>
Tue, 1 May 2007 09:41:05 +0000 (09:41 +0000)
committerJeremias Maerki <jeremias@apache.org>
Tue, 1 May 2007 09:41:05 +0000 (09:41 +0000)
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

src/java/org/apache/fop/pdf/PDFDocument.java
src/java/org/apache/fop/pdf/PDFRectangle.java
src/java/org/apache/fop/pdf/PDFStream.java
status.xml

index 29cb88731b49a296f66a3188b150d006090ff706..00d6c8e08a6ed5b4516e73a428f1dc95e6948aa7 100644 (file)
@@ -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);
index def6d9a2ba8d67e0ece4e46e39433a28c9c7bf93..e84227adf980617f5598c01d4776bea1436a277e 100644 (file)
@@ -79,7 +79,7 @@ public class PDFRectangle {
      * @return the PDF
      */
     public byte[] toPDF() {
-        return toPDFString().getBytes();
+        return PDFDocument.encode(toPDFString());
     }
 
     /**
index ea774857648889efed2f9f78ed6688c142f1f0eb..2cc9a1b0a87f189f9c20456e0e15ae832d5722ff 100644 (file)
@@ -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();
index 1570630a33fe401b985fbdd62ee48bef3525c380..37f0f53f9c77a477e61efada156a3438cc18d336 100644 (file)
@@ -28,6 +28,9 @@
 
   <changes>
     <release version="FOP Trunk">
+      <action context="Code" dev="JM" type="fix" fixes-bug="41434" due-to="Martin Kögler">
+        Fix PDF Genaration for non-ASCII compatible locales.
+      </action>
       <action context="Code" dev="VH, JM" type="add" importance="high" fixes-bug="36934">
         Add support for the collapsing-border model in tables.
       </action>