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.

8 Years
Discussion Span
Last Post by rogelioz

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"));


This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.