Java\'s default encoding is ASCII
. Yes? (See my edit below)
When a textfile is encoded in UTF-8
? How does a Reader know that he has to use
Java's default encoding depends on your OS. For Windows, it's normally "windows-1252", for Unix it's typically "ISO-8859-1" or "UTF-8".
A reader knows the correct encoding because you tell it the correct encoding. Unfortunately, not all readers let you do this (for example, FileReader
doesn't), so often you have to use an InputStreamReader
.