Hi, I'm trying to save some data taken from a ISO-8859-1 encoded page into a SQL SERVER 2005. The problem I have is that when I retrieve the information and put it in a XML there are characters missing. I'm using the URLEncoder.encode method to escape the "bad" characters from the html before saving the data, and I've tried several combination of charsets as a parameter(UTF-8 and ISO-8859-1). The XML can be iso or utf-8, it doesn't mather. I've been working on this for several hours but I can't seem to find the solution. Any ideas will be appreciated.

Thanks in advance.

Recommended Answers

All 3 Replies

It should be database specific problem.

Now if i use(after retrieving from the DB):

System.out.println(URLDecoder.decode(rs.getString(3), "UTF-8"));

It outputs well to the console, but when I write that to the xml it goes wrong...I'm using UTF-8 also for it...

Solution, using:

BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename),"UTF-8"));

instead of

BufferedWriter out = new BufferedWriter(new FileWriter(filename,"UTF-8"));

;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.