You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by zheng jianjun <ji...@yahoo.com.cn> on 2004/05/07 09:53:21 UTC

Codepage problem of FOM ?

Hi ,
 
had anybody encountered the below codepage problem in flowscipt ?
 
my env : 
 
redhat 8.0 (en) + tomcat 4.1.27 + cocoon 2.1.2 + ie6.0 (Chinese version) 
 
cocoon2.1.2 : container and form encoding are default value iso-8859-1
ie6.0 : always send URL in UTF-8 = true
 
a simple woody form , which had been saved as static file in codepage uft-8:
 
<?xml version="1.0" encoding="utf-8"?>
<wd:form xmlns:wd="http://apache.org/cocoon/woody/definition/1.0">
        <wd:field id="dfcode" required="true">
            <wd:label>Defect Code:</wd:label>
            <wd:datatype base="string">
                <wd:validation>
                   <wd:length min="6"/>
                   <wd:length max="10"/>
                </wd:validation>
            </wd:datatype>
        </wd:field>
......
 
 
the flow script  is something like following:
 
.....
var form = new Form("forms/myform.xml");
var model = form.getModel();
var myaction = Packages.mypkg.dbActions();
model.dfcode = "";
....
form.showForm("displays/screen1.xml");
// a Chinese word had input into model.dfcode
...
 
// insert it into database , the below statement worked well 
myaction.insert(String(model.dfcode));
...
 
model.dfcode = new Packages.java.lang.String((Packages.java.lang.String(model.dfcode)).getBytes("iso-8859-1"),"gb2312");
 
// Chinese word cannot be shown in following showFrom statement without the above  
 
form.showForm("displays/screen2.xml");
// the variable dfcode was shown again in this form
 
any idea of what is the problem ? 
 
thanks 
with regards.
j.j.zheng



---------------------------------
Do You Yahoo!?
嫌邮箱太小?雅虎电邮自助扩容!

Re: Codepage problem of FOM ?

Posted by Bruno Dumon <br...@outerthought.org>.
On Fri, 2004-05-07 at 09:53, zheng jianjun wrote:
> Hi ,
>  
> had anybody encountered the below codepage problem in flowscipt ?
>  
> my env : 
>  
> redhat 8.0 (en) + tomcat 4.1.27 + cocoon 2.1.2 + ie6.0 (Chinese
> version) 
>  
> cocoon2.1.2 : container and form encoding are default value iso-8859-1
> ie6.0 : always send URL in UTF-8 = true
>  
> a simple woody form , which had been saved as static file in
> codepage uft-8:
>  
> <?xml version="1.0" encoding="utf-8"?>
> <wd:form xmlns:wd="http://apache.org/cocoon/woody/definition/1.0">
>         <wd:field id="dfcode" required="true">
>             <wd:label>Defect Code:</wd:label>
>             <wd:datatype base="string">
>                 <wd:validation>
>                    <wd:length min="6"/>
>                    <wd:length max="10"/>
>                 </wd:validation>
>             </wd:datatype>
>         </wd:field>
> ......
>  
>  
> the flow script  is something like following:
>  
> .....
> var form = new Form("forms/myform.xml");
> var model = form.getModel();
> var myaction = Packages.mypkg.dbActions();
> model.dfcode = "";
> ....
> form.showForm("displays/screen1.xml");
> // a Chinese word had input into model.dfcode
> ...
>  
> // insert it into database , the below statement worked well 
> myaction.insert(String(model.dfcode));
> ...
>  
> model.dfcode = new
> Packages.java.lang.String((Packages.java.lang.String(model.dfcode)).getBytes("iso-8859-1"),"gb2312");

what you do here shouldn't ever be needed.

ISO-8859-1 doesn't support chinese characters, so use UTF-8 instead and
remove hacks like the one above.

I remember seeing some noise about Tomcat problems with regards to
encoding, but I don't know anything about it.

>  
> // Chinese word cannot be shown in following showFrom statement
> without the above  
>  
> form.showForm("displays/screen2.xml");
> // the variable dfcode was shown again in this form
>  
> any idea of what is the problem ? 
>  
> thanks 
> with regards.
> j.j.zheng
> 

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


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