1) I'm essentially trying to take this string (which is stored
properly and returns properly from the mysql database):

This is a test paragraph to test the DIRNET system. Trying to test's
and characters \. "this is another test" with @ and a #.This is a test
paragraph to test the DIRNET system.   < >

2) Which I then run htmlspecialchars($value, ENT_QUOTES) to get an
encoded string:

This is a test paragraph to test the DIRNET system. Trying to
test&#039;s and characters \. &quot;this is another test&quot; with @
and a #.This is a test paragraph to test the DIRNET system.   &lt;
&gt;

3) I then send it to my HTML page as part of a JSON object (via AJAX).
4) This is where the problem occurs, because using val() simply keeps
the string and keeps the encoded values as literals rather then
displaying as their proper decoded values.

If I load a page with the string already in the text area it renders
fine and doesn't cause problems if I were to say, have "</
textarea><textarea>234234</textarea>" loaded to it.  This is because
the 'bad' values had already been encoded and kept that way so the
site doesn't render them as HTML.  I essentially need to achieve this
same functionality but on the fly instead of at load.  All of my code
is working except this last piece.

Using .val() leaves it as a litteral, .text() does something similar
but does not render onto the page, and .html renders it but in IE
doesn't treat them as view only and acts as if it's full html.
Also, .text and .html both strip the "\" from the "\." string as well
as don't load into va().

I'm guessing I just need to manually convert those characters just
before I push them through .va(), but I'm not sure if that is the best
way to do it.

Reply via email to