cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Enke Michael <Michael.E...@wincor-nixdorf.com>
Subject Re: esql and UnsupportedEncodingException - patch proposal
Date Thu, 09 Aug 2001 09:39:41 GMT
Hi,
on tuesday I posted this patch to cocoon-dev,
seems to be equivalent with yours:

================================================================================
Hi,
I'd like to use <esql:get-string column="abc" encoding="UTF-8"/>
but for the encoding we have to catch
java.io.UnsupportedEncodingException
These exception is not catched yet.
Because I have no access to cvs I post the patch as
diff -u esql.xsl.orig esql.xsl

Regards,
Michael




--- esql.xsl.orig       Tue Aug  7 16:25:16 2001
+++ esql.xsl    Tue Aug  7 16:23:13 2001
@@ -637,6 +637,9 @@
         </xsl:choose>
       } catch (Exception _esql_exception_<xsl:value-of
select="generate-id(.)"/>_2) {}
     }
+    catch(java.io.UnsupportedEncodingException e) {
+      throw new RuntimeException(e.toString());
+    }
     if (_esql_queries.empty()) {
       _esql_query = null;
     } else {
================================================================================

Arnaud Bienvenu wrote:
> 
> 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: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message