Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4152393
Votes 5
Synopsis FileReader - new constructor to specify encoding
Category java:classes_io
Reported Against 1.2beta3
Release Fixed
State 3-Accepted, request for enhancement
Priority: 4-Low
Related Bugs
Submit Date 25-JUN-1998
Description




"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)
======================================================================
Work Around
N/A
Evaluation
N/A
Comments
  
  Include a link with my name & email   

Submitted On 29-MAR-2005
_grlea_
Please add constructors to FileReader and FileWriter that take an encoding argument.



PLEASE NOTE: JDK6 is formerly known as Project Mustang