On Feb 28, 2006, at 19:39, Andreas L Delmelle wrote:

<snip />
Already took a closer look at this, and this seemed already handled in RTFStringConverter. So, I wondered and wandered, and found that --see RTFListItem.RTFListItemLabel-- currently RTFListStyleBullet is unused. We know only RTFListStyleNumber and RTFListStyleText.

OK, so the error qua encoding is two-fold here:

- RTFHandler should force the OutputStreamWriter to use "US-ASCII" encoding - RTFListStyleText writes the bullet as 'text' (part of a control word) to the OutputStream

Is it allowed to use unicode escapes in control words? If so, the solution could be as simple as using RTFStringConverter to escape any 'text' if necessary.

In practice, my proposal would come down to

Index: src/java/org/apache/fop/render/rtf/RTFHandler.java
===================================================================
--- src/java/org/apache/fop/render/rtf/RTFHandler.java (revision 381394)
+++ src/java/org/apache/fop/render/rtf/RTFHandler.java  (working copy)
@@ -147,7 +147,7 @@
     public void startDocument() throws SAXException {
         // TODO sections should be created
         try {
-            rtfFile = new RtfFile(new OutputStreamWriter(os));
+ rtfFile = new RtfFile(new OutputStreamWriter(os, "US- ASCII"));
             docArea = rtfFile.startDocumentArea();
         } catch (IOException ioe) {
// TODO could we throw Exception in all FOEventHandler events? Index: src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ RtfListStyleText.java
===================================================================
--- src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ RtfListStyleText.java (revision 381394) +++ src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ RtfListStyleText.java (working copy)
@@ -63,7 +63,8 @@
         item.writeGroupMark(true);
         //item.writeControlWord("pndec");
         item.writeOneAttribute(RtfListTable.LIST_FONT_TYPE, "2");
-        item.writeControlWord("pntxtb " + text);
+        item.writeControlWord("pntxtb ");
+ RtfStringConverter.getInstance().writeRtfString(item.writer, text);
         item.writeGroupMark(false);
     }

Any objections? Suggestions for a better approach? (seems more like a quick fix; besides that, untested yet)


Cheers,

Andreas

Reply via email to