cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernhard Huber" <bh22...@i-one.at>
Subject Re: RE: Bug report for Cocoon 2 [2001/10/21]
Date Sat, 27 Oct 2001 14:50:57 GMT
hi,
i was trying to understand the problem of 
bug 4239.

As I was testing, i made following experience:
<%
  String s1 = "\u041d\u0430\u0433\u043b\u0430\u0432\u043d\u0443\u044e";
  String s2 = "&#1053;&#1072;&#1075;&#1083;";
%>
<page>
  <title>JSP Russian</title>
  <content>
    <para>s1,1 <%=s1%> wrong!!</para>
    <para>s1,2 <%=encode(s1)%> ok!!</para>
    <para>s2 <%=s2%> ok!!</para>
    <para>as is &#1053;&#1072;&#1075;&#1083; ok!!</para>
  </content>
</page>
<%!
  /* convert each c each of s to &#dddd; repr.
  */
  String encode( String s ) {
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < s.length(); i++ ) {
      char c = s.charAt(i);
      sb.append( "&#" ).append( (int)c ).append(";");
    }
    return sb.toString();
  }
%>

Hence using the encode() at least for all "russian" strings will
display the string correctly.
Now, why does this happen?
I suspect that JSPGenerator has problems pumping the jsp-result
into cocoon, reading bytes with no encoding?

Now, i made some more tests using xsp, and velocity, and
sadly i had some other problems. 
First the xsp example: 
<?xml version="1.0" encoding="UTF-8"?>
<!-- encoding="ISO-8859-1"? -->

<xsp:page
    language="java"
    xmlns:xsp="http://apache.org/xsp"
    xmlns:xsp-request="http://apache.org/xsp/request/2.0"
    xmlns:log="http://apache.org/xsp/log/2.0"
    xmlns:capture="http://apache.org/cocoon/capture/1.0"
>

<xsp:logic><![CDATA[
  /* convert each c each of s to &#dddd; repr.
  */
  String encode( String s ) {
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < s.length(); i++ ) {
      char c = s.charAt(i);
      sb.append( "&#" ).append( (int)c ).append(";");
    }
    return sb.toString();
  }
]]></xsp:logic>

  <page>
    <xsp:logic>
      String s1 = "\u041d\u0430\u0433\u043b\u0430\u0432\u043d\u0443
\u044e";
      String s2 = "&#1053;&#1072;&#1075;&#1083;";
    </xsp:logic>
  
    <title>XSP Russian1</title>
    <content>
      <para>s1,1 <xsp:expr>s1</xsp:expr> ok!! </para>
      <para>s1,2 <xsp:expr>encode(s1)</xsp:expr> wrong!! </para>
      <para>s2 <xsp:expr>s2</xsp:expr> wrong!!</para>
      <para>as is &#1053;&#1072;&#1075;&#1083; wrong!!</para>
    </content>
  </page>

</xsp:page>

Strangly exact s1,1 of jsp example is now WORKING! The
&#dddd; encoding does NOT work, which works in the jsp example.
A question to XSP experts how can i display the s2 string in an XSP,
How can I tell XSP that i really have a correct xml-snippet stored
in the String s2, avoiding any subst of '<', '>', and entities?

And at last the velocity example:
## Cannot use that encoding in velocity, how to write unicode in 
velocity?
##set( $s1 = "\\u041d\\u0430\\u0433\\u043b\\u0430\\u0432\\u043d\\u0443
\\u044e" )
#set( $s1 = "Íàãëàâíóþ" )
#set( $s2 = "&#1053;&#1072;&#1075;&#1083;" )

<page>
 <title>Velocity Russian1</title>
  <content>
    <para>s1 $s1 wrong!!</para>
    <para>s2 $s2 okay</para>
    <para>as is &#1053;&#1072;&#1075;&#1083; okay!!</para>
  </content>
</page>

That's the same situation as for jsp!

Now I didn't checked the code for JSPGenerator, and VelocityGenertor
in detail now regarding the "wrong!!" spots right now.
Perhaps as quick workarounde the encode() in jsp might help.

Well, that's for now i will start my debugger, and check
the JSPGenerator, and VelocityGenerator, or does
anyone has already some explanations, and/or solutions?

bye berni


----- Originalnachricht -----
Von: "Carsten Ziegeler" <cziegeler@sundn.de>
Datum: Mittwoch, Oktober 24, 2001 9:55 am
Betreff: RE: Bug report for Cocoon 2 [2001/10/21]

> You can either use the log transformer after the
> component of which you want to test the output.
> Or you can use the LoggingSAXConnector (in the cocoon.xconf).
> This SAXConnector simply logs the xml which is passed from
> one component to the other in the log.
> 
> Carsten
> 
> > -----Original Message-----
> > From: Bernhard Huber [mailto:bh22351@i-one.at]
> > Sent: Wednesday, October 24, 2001 1:32 AM
> > To: cocoon-dev@xml.apache.org
> > Subject: Re: Bug report for Cocoon 2 [2001/10/21]
> > 
> > 
> > hi
> > I was trying to understand the problem of bug 4239.
> > As i understand the jsp is compiled correctly,
> > i have not verified yet, scrambles the unicode chars.
> > Does anyone know how to 'trace' the pipeline, so i can
> > see what's passed from the jsp-generator to the transformer,
> > and from the transformer to the serializer?
> > 
> > 
> > ----- Originalnachricht -----
> > Von: bugzilla@apache.org
> > Datum: Sonntag, Oktober 21, 2001 7:00 pm
> > Betreff: Bug report for Cocoon 2 [2001/10/21]
> > 
> > > +--------------------------------------------------------------
> ----
> > > ---------+
> > > | Bugzilla Bug ID                                              
>    
> > >         |
> > > |     +--------------------------------------------------------
> ----
> > > ---------+
> > > |     | Status: UNC=Unconfirmed NEW=New         ASS=Assigned   
>    
> > >         |
> > > |     |         OPN=Reopened    VER=Verified    (Skipped 
> > > Closed/Resolved)   |
> > > |     |   +----------------------------------------------------
> ----
> > > ---------+
> > > |     |   | Severity: BLK=Blocker     CRI=Critical    
> MAJ=Major    
> > >         |
> > > |     |   |           MIN=Minor       NOR=Normal      
> > > EHN=Ehnancement       |
> > > |     |   |   +------------------------------------------------
> ----
> > > ---------+
> > > |     |   |   | Date Posted                                    
>    
> > >         |
> > > |     |   |   |          +-------------------------------------
> ----
> > > ---------+
> > > |     |   |   |          | Description                         
>    
> > >         |
> > > |     |   |   |          |                                     
>    
> > >         |
> > > | 2623|New|Nor|2001-07-13|Error: 500                           
>    
> > >         |
> > > | 2631|Opn|Nor|2001-07-15|JspGenerator doesn't allow relative 
> src  
> > >         |
> > > | 2787|New|Blk|2001-07-25|The /bi| 2850|Unc|Min|2001-07-
> 26|socket 
> > > write error                                |
> > > | 2986|New|Min|2001-08-
> 03|org.apache.cocoon.sitemap.ErrorNotifier 
> > > returns fi|
> > > | 3372|New|Nor|2001-09-02|Volume-Name SYS: becomes protocol on 
> > > Novell Netwar|
> > > | 3782|New|Nor|2001-09-23|No dependency check on xsl:import    
>    
> > >         |
> > > | 3785|New|Nor|2001-09-23|xinclude transformer doesn't resolve 
> > > relative urls|
> > > | 3804|New|Blk|2001-09-24|accessing localhost:8080/cocoon/ 
> gives 
> > > ComponentEx|| 3895|New|Nor|2001-10-01|Catalogs don't work on 
> XSLT 
> > > stylesheets           |
> > > | 4007|New|Blk|2001-10-05|corrupt xalan-2.2.0-dev.jar          
>    
> > >         |
> > > | 4020|New|Nor|2001-10-08|Error in request.xsl XSP logicsheet -
> 
> > > value-for-na|
> > > | 4038|New|Nor|2001-10-09|PDF generator does not accept legit 
> > > commands      |
> > > | 4062|New|Nor|2001-10-09|XIncludeTransformer not work inside 
> XSP 
> > > pages     |
> > > | 4063|New|Nor|2001-10-10|cocoon2 does not run with tomcat 4.0 
>    
> > >         |
> > > | 4115|New|Maj|2001-10-12|Matcher Factories are not inherited 
> to 
> > > subsitemaps|| 4117|New|Maj|2001-10-12|Server stops responding 
> with 
> > > a 100% CPU load when |
> > > | 4124|New|Nor|2001-10-12|StreamGenerator does not preserve 
> XML 
> > > encoding PI |
> > > | 4221|New|Nor|2001-10-16|Error in JaxpParser: Cannot find 
> > > org.apache.cocoon|| 4239|New|Blk|2001-10-17|Error while 
> generate 
> > > from JSP                     |
> > > | 4287|New|Enh|2001-10-19|[patch] New actions for Cocoon 2     
>    
> > >         |
> > > | 4289|New|Nor|2001-10-19|[patch] SectionCutter Action         
>    
> > >         |
> > > | 4293|Ass|Nor|2001-10-19|session:get-attribute bug            
>    
> > >         |
> > > | 4297|New|Nor|2001-10-19|Sitemap <map:match pattern="X"> 
> isn't 
> > > case sensiti|
> > > | 4298|New|Nor|2001-10-19|With wrong pi-logicsheet tag in xsp 
> > > cocoon doesn't|
> > > +-----+---+---+----------+-------------------------------------
> ----
> > > ---------+
> > > | Total   25 bugs                                              
>    
> > >         |
> > > +--------------------------------------------------------------
> ----
> > > ---------+
> > > 
> > > ---------------------------------------------------------------
> ----
> > > --
> > > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > > For additional commands, email: cocoon-dev-help@xml.apache.org
> > > 
> > > 
> > 
> 
> -------------------------------------------------------------------
> --
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 
> 

Mime
View raw message