Converting UNICODE to regular text

I don't know if the subject line really explains my problem. I'm reading some content from a URL and would like to write that content back to a database. This all works fine except when the Html of that URL contains character codes.

As an example: "Effects on blood lipids of a blood pressure & #8211; lowering....."

As you can see from this, it put instead of putting the dash (-). What I would like to write to my database is:

"Effects on blood lipids of a blood pressure?lowering diet..."

instead of

"Effects on blood lipids of a blood pressure & #8211; lowering....."

Does anyone have any ideas? Is there a way to transform all codes to there character equivalent?

Thanks for your help

(By the way, the html isn't quite right. I had to put it in brackets and insert a space for it to display correctly in the forum)

[893 byte] By [Ensonik] at [2007-9-26 4:12:54]
# 1
Hi,where do you get wrong characters? In a String after reading it from URL or after writing the String to database? If the later: what encoding is your database set for?Best regards,Martin
edosoft at 2007-6-29 13:19:08 > top of Java-index,Archived Forums,Java Programming...
# 2
The wrong coding is on the original HTML page. (In the source code which I pick up using a URL.openStream())Thanks for the help.
Ensonik at 2007-6-29 13:19:08 > top of Java-index,Archived Forums,Java Programming...
# 3

Hi again,

if you get wrong characters from the URL.openStream it is because the encoding set on your HTML page (probably in the header) is not the same as the default encoding used by your JVM on the client. If you know what encoding is on the HTML page you can set the same encoding for your stream. Use InputStreamReader(inputStream, encoding) for it. If you want to check the encoding of the page programaticaly you can use URLConnection.getContentEncoding() for it.

Hope it helps you,

Regards,

Martin

edosoft at 2007-6-29 13:19:08 > top of Java-index,Archived Forums,Java Programming...
# 4
Thanks for the help.
Ensonik at 2007-6-29 13:19:08 > top of Java-index,Archived Forums,Java Programming...