Hi there, I'm a professional programmer, but I'm out of ideas here.
I use the InnerHTML attribute to extract the HTML-code inside a div and use it in a different program (written in Progress 4GL).
My problem is that the innerHTML-code doesn't match the written HTML-code...
Special character codes like &#[some number];, ë and € are converted to their characterset equivalents and shown like that.
So if I extract those, I no longer see the html-code for these characters, I get some weird characters which even cause errors in my external program, because the charset mismatches.
It also happens when you use an alert, so this will do if you want to test:
<input type="button" value="test" onClick="alert(document.getElementById('showtest').innerHTML);" />
<div id="showtest">testë€ test</div>
FYI: it's for a Progress e-mail client.
Thanks for any information or suggestions, I've been thinking about a solition for quite some time, now.
Thanks for your quick response, mrhoo, I'll check if your solutions are applicable in my application, probably tomorrow.
I'm not making an online web application, it's a local web-client. The client uses an Internet Explorer plugin. Using an editable div-element in the page, I allow users to enter their message. But they can copy and paste from webpages or Word-files, so anything can be expected.
I hope that your solutions can be used from within Progress, because the innerHTML-attibute is currently being used to get the code.
I'll let you know if it succeeds or not.
The first one creates codes which are not interpreted automatically by the browser, the function you made (rescape) does create usable html-code.
My only problem was getting that code in Progress, using the IE-OCX. I couldn't pass a variable or get the result from a js-function, so I had to run the function, paste the code in a hidden input-tag and extract the code from there.
Anyway, thanks a lot, mrhoo.
If I find the time, I'll regularly check these forums to see if I can be of help to others too, but I'm a bit occupied at yoyogames.com.