3 Replies Latest reply on Jun 29, 2011 12:30 PM by rukbat

    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 java.io.FileInputStream one byte after another and print the contents to the console, i get the following values:

      But if i run it with java.io.FileReader 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