[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xml-cocoon-users
Subject:    upload and character encoding with cforms
From:       Sébastien_Geindre <sebastien.geindre () meteo ! fr>
Date:       2007-01-26 15:20:32
Message-ID: 45BA1C40.8030701 () meteo ! fr
[Download RAW message or body]

Hi cocooners !

I'va a little pb with upload widget and encoding.

Explanations:
i use upload widget in a form to upload ( ;-) , it sounds good!) an file 
which is an XML file
    <fd:upload id="upload" mime-types="text/xml" required="true"/>

XML file example : <?xml version="1.0" encoding="UTF-8"?><weatherData/>

in my flowscript, i try to handle the xml stream and give it to a cocoon 
pipe.

i use the following fonction handleUpload().
The probleme is that my xml data retrieved by weatherData = 
handleUpload(form) is encoded.
all the < character are encoded in &lt;

&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;weatherData&gt;


Any suggestion ?????
i've tried several charset    new 
java.io.InputStreamReader(stream,"UTF-8"));

sébastien.


function handleUpload(form) {

  var buf = new java.lang.StringBuffer();
 
  var uploadWidget = form.lookupWidget("upload");
  if (uploadWidget.getValue() != null) {
    var stream = uploadWidget.getValue().getInputStream();
    var reader = new java.io.BufferedReader(new 
java.io.InputStreamReader(stream));
    var line;
    while ((line=reader.readLine())!=null)
      buf.append(line).append("\n");

    reader.close();
  }
  return buf.toString();

-- 
Sébastien Geindre
DPREVI/AERO/DEV
sebastien.geindre@meteo.fr
05 61 07 84 93




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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic