JDK-4152393 : FileReader - new constructor to specify encoding
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.2.0,1.4.1
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: solaris_2.6,windows_xp
  • CPU: x86,sparc
  • Submitted: 1998-06-25
  • Updated: 2009-07-11
Description

Name: bk70084			Date: 06/25/98


"normally", to prepare to read from a file, you can use

FileReader fr = new FileReader("nameoffile");
BufferedReader br = new BufferedReader(fr);


But if you want to use a different character encoding, you have
to do

FileInputStream instr = new FileInputStream("nameoffile")
InputStreamReader instrR = new InputStreamReader(instr,"ENCODING");
BufferedReader br = new BufferedReader(instrR);


Compare this to the "old" way:
BufferedInputStream bis = 
  new BufferedInputStream(new InputStream("nameoffile", "ENCODING"));


Not only is the new way ugly, it feels like it is less efficient.
Please be more considerate of cross-locale coding, and add
methods to change the encoding at the FileReader() level.
(Review ID: 34240)
======================================================================