Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Change file encoding from ANSI to UTF-8

  1. #1
    Banned
    Join Date
    May 2011
    Posts
    26
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Change file encoding from ANSI to UTF-8

    I read from a file that may have ANSI or UTF-8 encoding, and by default BufferedWriter(new FileWriter(outFile) saves the file in ANSI. I would like to save it in UTF-8. How could I do that?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Change file encoding from ANSI to UTF-8

    There are I/O classes that take the encoding as a parameter to the constructor.
    For example see the OutputStreamWriter class.

Similar Threads

  1. Write to pdf file with pdfbox with greek encoding
    By javment in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: March 16th, 2011, 08:57 AM
  2. How to change File Type of a File Using java
    By akash169 in forum File I/O & Other I/O Streams
    Replies: 8
    Last Post: March 31st, 2010, 02:58 AM
  3. Problem with Japanese Encoding
    By sendhilpk in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: January 12th, 2010, 02:57 AM
  4. Run Length Encoding Problem
    By Scottj996 in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: January 7th, 2010, 07:24 AM
  5. Replies: 1
    Last Post: November 1st, 2009, 09:23 PM