Results 1 to 3 of 3
- 06-29-2011, 12:39 PM #1
Member
- Join Date
- Jun 2011
- Posts
- 2
- Rep Power
- 0
Compare FileReader and FileInputStream
hi,
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:
196
140
But if i run it with java.io.FileReader i get the following values:
196
338
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
- 06-29-2011, 01:37 PM #2
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.
- 06-29-2011, 03:00 PM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,442
- Rep Power
- 16
Similar Threads
-
problem regarding FileReader
By mukeshpaliwal in forum New To JavaReplies: 7Last Post: 10-01-2010, 03:15 PM -
FileReader Vs FileInputStream and same goes to output
By unhurt in forum New To JavaReplies: 5Last Post: 02-02-2010, 09:06 AM -
FileReader help
By emp in forum New To JavaReplies: 1Last Post: 07-28-2009, 04:41 AM -
add FileReader to GUI
By VinTiger in forum New To JavaReplies: 8Last Post: 05-11-2009, 12:23 AM -
Help with filereader in java
By zoe in forum Advanced JavaReplies: 2Last Post: 07-26-2007, 09:55 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks