Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4152393

FileReader - new constructor to specify encoding

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0, 1.4.1
    • core-libs
    • x86, sparc
    • solaris_2.6, windows_xp



      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)
      ======================================================================

            Unassigned Unassigned
            bklocksunw Brian Klock (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: