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

RFE : Create additional Properties.load() method that accepts character encoding

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.1
    • core-libs
    • generic
    • generic



      Name: ddT132432 Date: 12/04/2001


      java version "1.3.1_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
      Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)

      Currenly the java.util.Properties.load() method looks like:

      public synchronized void load(InputStream inStream) throws IOException {

              BufferedReader in = new BufferedReader(new
                                      InputStreamReader(inStream, "8859_1"));
              while (true) {
                  // Get next line
                  String line = in.readLine();
                  if (line == null)
                      return;
          .
          .
          .

      Suggest that we create another Properties.load() method that looks like:

      public synchronized void load(InputStream inStream, String encoding)
                               throws IOException {
              BufferedReader in = new BufferedReader(new
                                      InputStreamReader(inStream, encoding));
              while (true) {
                  // Get next line
                  String line = in.readLine();
                  if (line == null)
                      return;
          .
          .
          .

      This will allow for loading of multi-byte property files when the encoding of a
      file is known (and the old load method can exist for backward compatabliity with
      existing API's and for when the encoding is not known).
      (Review ID: 136762)
      ======================================================================

      If you do consider adding this RFE, it might not be a bad idea to also include an additional constructor for java.util.PropertyResourceBundle

      that looks like:
      public PropertyResourceBundle(InputStream stream, String encoding)
            throws IOException {
           lookup.load(stream, encoding);
       }
       .
       .
       .

      ###@###.### 2001-12-05

            Unassigned Unassigned
            ddressersunw Daniel Dresser (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: