Reputation: 604
I've got to read a file (it contains text) encoded through ASCII. I decided to use Bufferedreader class. I know that, when I deal with files encoded through UTF-8, I can specify the encoding using Bufferedreader. When I deal with ASCII files have I to specify the encoding type?
Thanks
Alessio
Upvotes: 0
Views: 1094
Reputation: 1499770
No, you should specify an encoding using InputStreamReader
- BufferedReader
doesn't let you specify the encoding.
For ASCII files you're likely to be okay with the platform default encoding (most defaults are compatible with ASCII), but personally I think it's best practice to always explicitly specify the encoding - it makes it clear what your intentions are, and that you really thought about it.
Upvotes: 1