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. Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org Yannis Haralambous <yannis.haralamb...@telecom-bretagne.eu> wrote on 10/05/2009 10:34:00 AM: > thank for you answer > > but still there are some things I don't understand: > > 1) the locale of my system is: > > LANG="fr_FR.UTF-8" > LC_COLLATE="fr_FR.UTF-8" > LC_CTYPE="fr_FR.UTF-8" > LC_MESSAGES="fr_FR.UTF-8" > LC_MONETARY="fr_FR.UTF-8" > LC_NUMERIC="fr_FR.UTF-8" > LC_TIME="fr_FR.UTF-8" > LC_ALL= > > so, clearly, UTF-8 is the default encoding of my platform. If the > default encoding is not the one of the locale, then what is it? > > 2) using MacRoman is an anachronism: that encoding was used in MacOS > 9, and current MacOS 10.6 has absolutely no way of running MacOS 9 > applications. MacRoman is dead and buried, what I'm seeing is a ghost? > > How can I change the behavior of PrintStream.print() ?? > > thanks in advance > > Le 5 oct. 2009 à 15:33, Michael Glavassevich a écrit :? > > FYI: I meant PrintStream.print() [1] though the PrintWriter variant > also uses the default encoding. > > [1] http://java.sun.com/javase/6/docs/api/java/io/PrintStream. > html#print(java.lang.String) > > Michael Glavassevich > XML Parser Development > IBM Toronto Lab > E-mail: mrgla...@ca.ibm.com > E-mail: mrgla...@apache.org > > Michael Glavassevich/Toronto/i...@ibmca wrote on 10/05/2009 09:24:39 AM: > > > kesh...@us.ibm.com wrote on 10/05/2009 09:19:32 AM: > > > > > > There is no stylesheet, I'm not using any XSLT file. It is simply > > > SAX reading the XML file and writing to standard output. > > > > > > Sorry; I'm used to thinking in terms of Xalan rather than Xerces and > > > gave the wrong answer. > > > > > > Can you confirm whether the problem is occurring in the parser or on > > > the the writing-to-standard-output side? > > > > > > How are you setting up the SAX serializer? > > > > He's not. The code is writing to System.out.println() [1] which > > always uses the platform's default encoding. One of those Java I/O > > gotchas folks keep tripping over. Has nothing to do with SAX or Xerces. > > > > > Or, if you aren't using our serializer, how are you writing to > > > standard output? > > > > > > ______________________________________ > > > "... Three things see no end: A loop with exit code done wrong, > > > A semaphore untested, And the change that comes along. ..." > > > -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (http://www.ovff. > > > org/pegasus/songs/threes-rev-11.html) > > > > Thanks. > > > > [1] http://java.sun.com/javase/6/docs/api/java/io/PrintWriter. > > html#print(java.lang.String) > > > > Michael Glavassevich > > XML Parser Development > > IBM Toronto Lab > > E-mail: mrgla...@ca.ibm.com > > E-mail: mrgla...@apache.org > > -- > +-----------------------------------------------------------------------+ > | Yannis Haralambous, Ph.D. yannis.haralamb...@telecom-bretagne.eu | > | Directeur d'Études http://omega.enstb.org/yannis | > | twitter : y_haralambous | > | Tel. +33 (0)2.29.00.14.27 | > | Fax +33 (0)2.29.00.12.82 | > | Département Informatique | > | Télécom Bretagne | > | Technopôle de Brest Iroise, CS 83818, 29238 Brest Cedex 3, France | > | Coordonnées Google-Earth : 48°21'31.57"N 4°34'16.76"W | > +-----------------------------------------------------------------------+ > ...pour distinguer l'extérieur d'un aquarium, > mieux vaut n'être pas poisson, > > ...the ball I threw while playing in the park > has not yet reached the ground > > Es gab eine Zeit, wo ich nur ungern über Schubert sprechen, > nur Nächtens den Bäumen und Sternen von ihm vorerzählen mögen. > [attachment "Yannis Haralambous.vcf" deleted by Michael > Glavassevich/Toronto/IBM]