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
[EMAIL PROTECTED]
05 61 07 84 93




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

Reply via email to