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

jdk 1.3.1 not supporting UTF 8 character set

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 1.3.1
    • core-libs



      Name: nt126004 Date: 06/06/2002


      FULL PRODUCT VERSION :
      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)


      FULL OPERATING SYSTEM VERSION :
      SunOS appdpp2 5.8 Generic_108528-14 sun4u sparc
      SUNW,UltraSPARC-IIi-cEngine

      A DESCRIPTION OF THE PROBLEM :
      I am trying to read a file with non-ASCII (spanish)
      characters and display it in console. When I run the
      program in java version "1.2.2" Solaris VM (build
      Solaris_JDK_1.2.2_08, native threads, sunwjit) its
      perfectly working. But if I run the same thing in java
      1.3.1 its displaying question marks(?) for all non-ASCII
      characters.
      I am thinking this is a bug in java 1.3.1. I am running
      weblogic 6.1 which will only run under 1.3.1.


      REGRESSION. Last worked in version 1.2.2

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Compile source code
      2. run it under jdk1.2.2 version
      3. run it under jdk1.3.1 version

      See source code:
      utffile.txt file should have spanish characters in it.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Expected:
      Should display spanish characters

      Actual:
      Displaying non-ascii characters as question marks.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      no error messages.

      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------

      public class TestUTF
      {
      public static void main(String args[])
      {
      String filename = "utffile.txt";
      String str = "";
       try
       {
      System.getProperty("file.encoding");
              File inputFile = new File(filename);
              FileInputStream fis = new FileInputStream(inputFile);
              InputStreamReader isr = new InputStreamReader(fis,"UTF-8");
              Reader in = new BufferedReader(isr);
                  StringBuffer buf = new StringBuffer();
                  int ch;
                  while ((ch = in.read()) > -1) {
                      buf.append((char)ch);
                  }
                  in.close();
                 str = buf.toString();

              } catch (IOException e) {
                  e.printStackTrace();
              }
              System.out.println(str);
              System.out.println("\n");
       }
       catch(Exception ee)
       {}
      }

      // utffile.txt
      Estimado Testuser,

      Gracias por registrarse para Company, nuestra comunidad de desarrolladores internacional. Company le ayudar?? a movilizar sus productos y servicios ofreciendo servicios web, informaci??n y respaldo.
      A continuaci??n figuran su nombre de usuario y palabra clave. Por el bien de su seguridad, nos permitimos recordarle que nadie m??s est?? autorizado a utilizar su nombre de usuario y palabra clave.

      Sus datos son:

      Nombre de usuario: username
      Palabra clave: password

      Si conoce alg??n colega que se beneficiar??a de la utilizaci??n del sitio, s??rvase solicitarle que visite http://www.via.vodafone.com, en donde podr?? registrarse.
      Esperamos que encuentre ??til este sitio web. S??rvase recordar que este sitio ha sido dise??ado para Ud., por lo que quisi??ramos escuchar sus ideas y opiniones en referencia a nuevo contenido y a la funcionalidad del sitio. Para enviarnos su formulario para comentarios, s??rvase enviar un correo electr??nico a ###@###.### o de manera alternativa complete el formulario para comentarios en el sitio web de Company .

      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      i dunno
      (Review ID: 148218)
      ======================================================================

            ilittlesunw Ian Little (Inactive)
            nthompsosunw Nathanael Thompson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: