Stefan Ram schrieb:
>> When writing into a Unicode text file, given that the Stream
>> encoding was set to »UTF-8«, what is the proper, best or
[quoted text clipped - 10 lines]
>> printStream.print(( char )0x2028 ); // 0x2028 is Unicode »line
>> separator«
> Not to forget
> printStream.println();
Lest we forget:
> All characters printed by a PrintStream are converted into bytes using the platform's default character encoding. The PrintWriter class should be used in situations that require writing characters rather than bytes.
Assuming that your variable "printStream" is of type "PrintStream", which you
did not aver.
I get a cringe seeing "the Stream encoding was set" - Java IO Streams don't
have encodings. The PrintStream methods use encodings, but the Stream doesn't.
To answer your question, printf()'s "%n" specifies "the platform-specific line
separator", but that has nothing to do with encodings.

Signature
Lew
Roedy Green - 12 Jul 2007 04:16 GMT
>I get a cringe seeing "the Stream encoding was set" - Java IO Streams don't
>have encodings. The PrintStream methods use encodings, but the Stream doesn't.
When you are playing with encodings you use a Reader/Writer.
see http://mindprod.com/applet/fileio.html
for sample code.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com