With latest CVS Cocoon2, if you specify the encoding attribute within
<esql:get-string> or <esql:get-columns> tags, you have to enclose your tags
inside a try/catch structure because they may throw
java.io.UnsupportedEncodingException.

At the end of this mail you will find a patch to workaround this problem. I
don't know if it's a good or clean job, but it's very useful for me, so I
post it to you.

For example, the tedious
<xsp:logic>
  try {
    <esql:get-string column="name" encoding="iso-8859-1"/>
  } catch (java.io.UnsupportedEncodingException e) {
    System.out.prinln("Grumpf");
  }
</xsp:logic>

Becomes merely
<esql:get-string column="name" encoding="iso-8859-1"/>

Info : you need to set the encoding so that special characters will be
correctly fetched (i.e. accentuated letters in latin languages)

Index: src/org/apache/cocoon/components/language/markup/xsp/java/xsp.xsl
===================================================================
RCS file: 
/home/cvspublic/xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/java/xsp.xsl,v
retrieving revision 1.5
diff -u -r1.5 xsp.xsl
--- src/org/apache/cocoon/components/language/markup/xsp/java/xsp.xsl   2001/07/23 
23:33:45     1.5
+++ src/org/apache/cocoon/components/language/markup/xsp/java/xsp.xsl   2001/08/08 
+14:37:14
@@ -37,6 +37,7 @@
 
     import java.io.File;
     import java.io.StringReader;
+    import java.io.UnsupportedEncodingException;
     //import java.net.*;
     import java.util.Date;
     import java.util.List;
@@ -98,7 +99,7 @@
         /**
         * Generate XML data.
         */
-      public void generate() throws SAXException {
+      public void generate() throws SAXException, UnsupportedEncodingException {
             this.contentHandler.startDocument();
             AttributesImpl xspAttr = new AttributesImpl();


-- 
Arnaud Bienvenu
http://www.generasound.com/

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to