cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jay Freeman \(saurik\)" <sau...@saurik.com>
Subject [PATCH] Good Fix for Encoding Issue :)
Date Sun, 25 Mar 2001 21:59:16 GMT
ALL RIGHT!!! I GOT IT!!!

It turns out this has nothing to do with the default encoding on the system.
I finally figured out that it was ISO-8859-1 for me anyway, not UTF-8, which
pretty much closed off that area of research.  I traced the encoding back
far enough until I noticed that Xerces was being left in charge of it.  The
default we are looking for isn’t the system default, but the Xerces
OutputFormat default.  This is where the solution lies:

Index: src/org/apache/cocoon/formatter/AbstractFormatter.java
===================================================================
RCS file:
/home/cvspublic/xml-cocoon/src/org/apache/cocoon/formatter/AbstractFormatter
.java,v
retrieving revision 1.5
diff -u -r1.5 AbstractFormatter.java
--- src/org/apache/cocoon/formatter/AbstractFormatter.java      2001/03/07
22:32:16     1.5
+++ src/org/apache/cocoon/formatter/AbstractFormatter.java      2001/03/25
21:57:15
@@ -88,6 +88,8 @@
         encoding = (String) conf.get("encoding");
         if (encoding != null) {
             format.setEncoding(encoding);
+        } else {
+            encoding = format.getEncoding();
         }

         doctypePublic = (String) conf.get("doctype-public");

Even if you don’t set the encoding on an OutputFormat, it can come with
something already set inside of it.  This causes a disparity between the
encoding String member and the getEncoding() property of the format
OutputFormat member.  Of course, this comes after backing out the
FO2PDFFormatter.java changes.

BTW, why do we even have the encoding variable there?  Wouldn’t it make more
sense to just have AbstractFormatter.getEncoding() return
format.getEncoding() ?  Are we using it really often in other areas of the
code?  It seems bad that there are two different ways to get access to the
same value if they can go out of sync like this.

Sincerely,
Jay Freeman (saurik)
saurik@saurik.com <mailto:saurik@saurik.com>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message