4 Replies Latest reply: May 24, 2012 2:59 AM by 835833 RSS

    Java encoding problem

    835833
      Hi

      I am trying to get a file name which is in Korean Characters using getName() in Oracle Application.

      part of the code is

      File dir = new File(importpath);
      File[] files = dir.listFiles();

      for (int i = 0; i < files.length; i++){

      File file = files;
      String name = file.getName();
      System.out.println("name is " + name);
      }

      Name of the korean file name is 홍길동.pdf
      The output is ȫ�浿.pdf

      i tried to convert the character set using the following code

      byte[] bytes = name.getBytes();
      String filename1 = new String(bytes, "KSC5601");

      The out put of filename1 is 홍占썸동.pdf which does not match with the original file name..

      i printed the default encoding using file.encoding() and it is UTF-8.

      Please Help

      Edited by: user776957 on May 23, 2012 4:27 AM