Torsten

You are my hero !!!!!

function getSourceAsString(uri) {
        return ( org.apache.avalon.excalibur.io.IOUtil.toString(
                new java.io.BufferedInputStream(
                        
org.apache.cocoon.components.source.SourceUtil.getInputSource(
                                resolve(uri)
                        ).getByteStream()
                ), "UTF-8"
        );
}

Yes, I should have added the encoding to
        org.apache.avalon.excalibur.io.IOUtil.toString(inputStream, encoding)

I works again ;)

Many thanks mate !!

regards Jeremy

On 3 Dec 2004, at 14:47, Torsten Curdt wrote:

Mate,

I am not totally sure but...

Technique:
I read the XML Source to a String (to add to the textarea widget) like this:
var string = org.apache.avalon.excalibur.io.IOUtil.toString(
new java.io.BufferedInputStream(
org.apache.cocoon.components.source.SourceUtil.getInputSource(
resolver.resolveURI(uri)
).getByteStream()
)
);

if you create a String from a byte stream, array or whatever is byte-based don't you have to specify the charset? AFAIK creating a String from a byte array uses the platform default charset.

form.lookupWidget("xhtml").setValue(string);

did you check whether the string looks fine here?

...just what came up to my mind right away

HTH

cheers
--
Torsten


--------------------------------------------------------

                  If email from this address is not signed
                                IT IS NOT FROM ME

                        Always check the label, folks !!!!!
--------------------------------------------------------


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to