You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Dominic Looser <do...@gmail.com> on 2012/09/28 14:23:47 UTC
Character encoding with using System.out
Hello,
when writing a model to the command line via
model.write(System.out, "TURTLE")
the character encoding is wrong (the literal "Führerschein"
gets "Führerschein". When I use a FileOutputStream to write
the model to a file, the encoding is correct. Why is that?
Best,
Dominic
Re: Character encoding with using System.out
Posted by Andy Seaborne <an...@apache.org>.
On 28/09/12 13:23, Dominic Looser wrote:
> Hello,
> when writing a model to the command line via
> model.write(System.out, "TURTLE")
> the character encoding is wrong (the literal "Führerschein"
> gets "Führerschein". When I use a FileOutputStream to write
> the model to a file, the encoding is correct. Why is that?
> Best,
> Dominic
>
(jena version?)
The Turtle writer does not do anything different; it always writes
UTF-8. It does not use the "PrintStream" nature of System.out because
that has an implicit charset (see javadoc). It is the platform default -
and that is not generally.
So first, check that it is not the way you view the output from
System.out, and not output from System.out itself.
Send to output from System.out a file and view the same way your viewed
the output when using FileOutputStream in a UTF-8 aware editor. The
console can be funny especially on MS Windows.
With charsets, everything on the whole path from programme to pixels on
screen has to be right. There are many places it can go wrong.
Andy