Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2010
    Posts
    8
    Rep Power
    0

    Default How to encode a fileHandler to output french characters ?

    Hi everyone,

    I'm trying to encode a fileHandler to create a file that contains french special characters (, , . . . .).

    I tried the following code:
    fileHandler.setEncoding("ISO-8859-1");

    and the following
    fileHandler.setEncoding("UTF-8");

    But still the output returns a question mark instead of the and a square instead of the respectively.

    Can anyone advice how to encode the fileHandler to have french characters in the output file ?

    Thanks

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,445
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by l.najm@acteos.com View Post
    Hi everyone,

    I'm trying to encode a fileHandler to create a file that contains french special characters (, , . . . .).

    I tried the following code:
    fileHandler.setEncoding("ISO-8859-1");

    and the following
    fileHandler.setEncoding("UTF-8");

    But still the output returns a question mark instead of the and a square instead of the respectively.

    Can anyone advice how to encode the fileHandler to have french characters in the output file ?

    Thanks
    Are you sure it's not a font problem? There can be a couple of problems:

    1) en- and decoding the bytes
    2) displaying the resulting characters.

    Try to write such a special character as if it were an int (int)chr and see if the Unicode value is correct. If so you have to use another font. If not, you have an en- or decoding problem.

    kind regards,

    Jos

  3. #3
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    Try encoding with UCS-2. UTF-8 and ISO-8859-1 are both legacy formats that do not support international character sets.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default

    Quote Originally Posted by toadaly View Post
    Try encoding with UCS-2. UTF-8 and ISO-8859-1 are both legacy formats that do not support international character sets.
    UTF-8 does. That's the whole point. That's why it uses variable length characters, to fit the Unicode charset in.

    UCS-2 is the one that's been superseded...by UTF-16. But UTF-8 is still used, and valid...it isn't legacy by any means.

  5. #5
    Join Date
    Apr 2010
    Posts
    8
    Rep Power
    0

    Default

    Thanks,

    It turned out that the characters differed from a tool to another.
    the "ISO-8859-1" turned out to output the french characters in most text reader tools.

Similar Threads

  1. Url Encode
    By Sean_J in forum New To Java
    Replies: 0
    Last Post: 03-19-2010, 02:54 PM
  2. Replies: 2
    Last Post: 03-09-2010, 08:18 AM
  3. Java logging - log file location for FileHandler
    By kfir.wolfson@gmail.com in forum Advanced Java
    Replies: 2
    Last Post: 03-24-2009, 08:22 AM
  4. Java, output string, getting correct output? HELP!
    By computerboyo in forum New To Java
    Replies: 2
    Last Post: 02-25-2009, 11:44 PM
  5. Getting problem in UTF-8 Encode/Decode with Java
    By sagarsway in forum Advanced Java
    Replies: 2
    Last Post: 12-22-2008, 07:01 PM

Tags for this Thread

Posting Permissions

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