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

FileReader - new constructor to specify encoding

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 1.2.0, 1.4.1
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86, sparc
    • OS:
      solaris_2.6, windows_xp

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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Imported:
                Indexed: