Results 1 to 3 of 3
  1. #1
    yuvalzi is offline Member
    Join Date
    Jun 2011
    Rep Power

    Default Compare FileReader and FileInputStream


    I have a file with the following char, saved as utf-8:

    The character is the unicode hex value "010C" (Latin Extended-A).
    As much as i understand it is saved as binary values: 00000001 00001100
    I am running on windows XP and the default character-set of the JVM is the codebase "windows-1252".

    When reading the values with one byte after another and print the contents to the console, i get the following values:

    But if i run it with i get the following values:

    Why is there such a difference?

    Why doesnt it print:
    1 -- equivalent to first 2 hex digits - (01)
    12 -- equivalent to last 2 hex digits - (0C)

    Thanks Yuval

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power


    Can you post the code?
    Hex 0x01 is not the same as the char '1' or the String "1".

    Can you read the file in a hex editor and post its contents in hex.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power


    And can you pick one of your two posts (that I've spotted) and close the other one?
    Because double posting is a bit rude...and impatient.

    See my post on the other thread you started...

Similar Threads

  1. problem regarding FileReader
    By mukeshpaliwal in forum New To Java
    Replies: 7
    Last Post: 10-01-2010, 04:15 PM
  2. Replies: 5
    Last Post: 02-02-2010, 10:06 AM
  3. FileReader help
    By emp in forum New To Java
    Replies: 1
    Last Post: 07-28-2009, 05:41 AM
  4. add FileReader to GUI
    By VinTiger in forum New To Java
    Replies: 8
    Last Post: 05-11-2009, 01:23 AM
  5. Help with filereader in java
    By zoe in forum Advanced Java
    Replies: 2
    Last Post: 07-26-2007, 10:55 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