Reading/Writing a Different Character Set
You need to read or write a text file using a particular encoding.
text to or from internal
Unicode by specifying a converter when you construct an
are the bridge from byte-oriented
Streams to character-based
Readers. These classes read or write bytes and
translate them to or from characters according to a specified
character encoding. The Unicode
character set used inside Java (
String types) is a 16-bit character set. But most
character sets, such as ASCII, Swedish, Spanish, Greek, Turkish, and
many others, use only a small subset of that. In fact, many European
language character sets fit nicely into 8-bit characters. Even the
larger character sets (script-based and pictographic languages)
don’t all use the same bit values for each particular
, then, is a mapping between Unicode
characters and a particular external storage format for characters
drawn from a particular national or linguistic character set.
To simplify matters, the
OutputStreamWriter constructors are the only
places where you can specify the name of an encoding to be used in
this translation. If you do not, the platform’s (or
user’s) default encoding will be used.
and the like all use whatever encoding the
OutputStreamWriter class uses. Since ...