Le 5 oct. 2009 à 17:23, Michael Glavassevich a écrit :

Wrap System.out in an OutputStreamWriter:

Writer writer = new OutputStreamWriter(System.out, "UTF-8");

and call the write() methods on this Writer. Always do this when you want a specific encoding. Relying on the default encoding is a bug waiting to happen even if you think you can control it.

Thanks.




Thank you for the advice
After several attempts, when writing

public void characters(char[] ch, int start, int length) throws SAXException
    {
        try
        {
                OutputStream out=System.out;
                OutputStreamWriter writer = new OutputStreamWriter(out, 
"UTF-8");
                String s = new String(ch, start, length);
               writer.write(s);
       }
        catch (IOException e) {}
    }

the file compiles, but I don't get any output… What is wrong???






Reply via email to