Results 1 to 2 of 2
  1. #1
    valery is offline Member
    Join Date
    Jul 2007
    Rep Power

    Default How to convert the encoding of a file

    I want to convert the encoding of a file. Does JDK include the tool?
    Can you send me sample code?

  2. #2
    katie is offline Member
    Join Date
    Jul 2007
    Rep Power


    if the content of the foo.txt file is a collection of ISO8859-1 characters:
    Java Code:
    BufferedReader br = new BufferedReader
    (new InputStreamReader(new FileInputStream("foo.txt"), "ISO8859_1"));
    Read them lines into an ArrayList. Then,

    Java Code:
    PrintWriter pw = new PrintWriter("foo.txt", "UTF8");
    would overwrite the foo.txt with UTF-8 characters.

Similar Threads

  1. Replies: 1
    Last Post: 09-27-2008, 01:42 AM
  2. Some help with encoding...
    By nm123 in forum Networking
    Replies: 0
    Last Post: 04-15-2008, 12:22 AM
  3. Missing text encoding
    By talgreen in forum Eclipse
    Replies: 0
    Last Post: 03-30-2008, 08:14 PM
  4. Replies: 1
    Last Post: 03-28-2008, 05:08 PM
  5. Convert my class file into a exe file
    By carl in forum New To Java
    Replies: 1
    Last Post: 08-05-2007, 08:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts