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

[475 byte] By [tomtom1979] at [2007-9-26 3:33:46]
# 1

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?

schapel at 2007-6-29 12:02:33 > top of Java-index,Archived Forums,Java Programming...
# 2

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

tomtom1979 at 2007-6-29 12:02:33 > top of Java-index,Archived Forums,Java Programming...
# 3

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

tomtom1979 at 2007-6-29 12:02:33 > top of Java-index,Archived Forums,Java Programming...
# 4
hii am also having similar problem. I want to use multipart data in java. i want to use url and url connection. i have to do post with encoding multipart.thanksvijay
vijaymail2 at 2007-6-29 12:02:33 > top of Java-index,Archived Forums,Java Programming...
# 5
> hi> > i am also having similar problem. I want to use> multipart data in java. i want to use url and url> connection. i have to do post with encoding> multipart.> ... and you have some problems with it?
jsalonen at 2007-6-29 12:02:35 > top of Java-index,Archived Forums,Java Programming...