Hey guys

So I've been struggling with a problem.

I have a javascript function that's returning UTF-8 encoded content which I need to display on my iso-8859-1 encoded page.

If I just output it, things such as "tm" (utf-8 encoded) comes out as 3-4 random characters.

I tried various functions I've found on the internet


but have had no luck. The most promising was the second, which was the use of the function decodeURIComponents. This worked in Safari.

But in Firefox and IE it caused an error "malformed URI sequence" which was presumably from some characters in the text.

any help?