Skip to main content

xml stream to file and back til stream

3 replies [Last post]
slingblade
Offline
Joined: 2007-10-18

Hi,

-I'm having java app on a Linux server downloading an xml feed.
-The app saves the inputstream to a file to the filesystem.
-Then another app loads the file and hands it as the inputstream to a DocumentBuilder object, by calling its parse method.

=>Now the format of the text is no longer the same as it was when downloading.
I guess its a Unicode vs ISO-8859-1 problem.

What to do?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
vali_nedelcu
Offline
Joined: 2006-02-02

> =>Now the format of the text is no longer the same as
> it was when downloading.
> I guess its a Unicode vs ISO-8859-1 problem.
>
> What to do?

What don't you convince yourself first?

slingblade
Offline
Joined: 2007-10-18

I found a simple solution.

I downloaded the file as bytes and saved it as a binary file.
Then when loading the file again, I experimented with the charset and found one that was useful..

The problem with was that the FileWriter object used the OS platform's default encoding and thus f**ks up a perfectly fine file when saving it.

joyatiitr
Offline
Joined: 2009-06-21

Hey I am trying to achive similar stuff. can you share the code