File Writer doesn't want to write a specific char !
Hi everyone,
here is the damned problem :
I am actually using both a BufferedReader and a BufferedWriter in order to perform a copy of the file. For some reasons I cannot use Input or OutputStreams. The fact is, when I read the char with the value 65533, even if I write this value it is different : the written value is 63 !
Any help will be warmly welcomed ...
Thanks,
Thomas
Imagine Broadband Limited, Developer-Consultant
If you're copying files, you probably want to make a binary copy. Readers and Writers translate between bytes and chars using various character encodings -- this is probably not what you want unless you want to translate from one character encoding to another.
Why can't you use InputStreams and OutputStreams?
Thank for answering,
the fact is, I am parsing a multipart-form content in which I must match some parameters with their values, and the file data is encapsulated inside all these data. I have to check when I reach the end of the file data and this is performed easily with String comparisons. This is possible only with a BufferedReader (I use the readLine() method).
The most amazing is that this is only the character 0x81 (129 in ASCII) that is wrongly translated into 0x3F (63)
I thought anyone would have had a asimilar problem, but anyway, I am going to look into the java sources...
Thomas
At last ! I found the solution :
I have to construct a BufferedReader from an InputStreamReader specifying the encoding "ISO-8859-1"
-and for the writer as well- and it solves the problem !
I guessed it could have been such a problem but I had not tried to specify the encoding yet...
Hope it helps others
Thomas