in reply to Handling special characters in JSON

A Google search of perl json special characters produced a wealth of suggestions.

(I do not mean any “slight” by making this particular suggestion.   This is not meant as a “JGI” or “RTFG” response.)

Several of the articles discuss your options on both the client and the server side.   Frankly, I think that the best long-term solution to your problem will include choosing a good, robust client-side JavaScript tool that will take-on the responsibility of handling recalcitrant software ... particularly “IE-anything.”   (And, let’s face it, the bugaboo is always going to be Internet Explorer, in some incarnation or another...   You need to attack the problem from both the client and the server side of the fence, and to shove the client-side burden onto a third party JavaScript-kit provider.   (Don’t worry... they’re used to it.)

Replies are listed 'Best First'.
Re^2: Handling special characters in JSON
by mcm1303 (Initiate) on Dec 15, 2010 at 21:55 UTC
    Thanks sundials. I've become accustomed to using plain old eval() but I'll try your suggestion. In addition to hopefully solving my problem client-side solutions that go beyond eval() will no doubt be more secure because malicious code can be embedded in JSON.

      Yes, “simple eval()” is Not A Good Thing ... and “Doing It Yourself” is Definitely Not.

      I have read plenty of documents, for ExtJS and Prototype and several other JavaScript platforms, which describe all the whys and wherefores of what they actually do (and, over time, continue to have to do...), just to make it work at all.   And I come away saying, “Good Grief!   Better You Than Me!”   When I read stuff that says, “Internet Explorer 7 Service-Pack 2 does it this way, but Service-Pack 3 does it that way” ... why, it made me want to switch religions.   ;-)

      It really is a testament to how good these folks are, that not only does it work “at all,” but it actually works well.   Just be sure to do exactly what they tell you to do.   These are well-traveled waters... full of now-familiar rocks.   “Where the well-worn chart tells you to turn left ... turn left, (pray,) and don’t ask questions.”   :-D

      Some JS frameworks are very lean-and-mean.   Others are, “it slices, it dices, it even makes Julienne fries... on sale today!”   But I guess that comes with the territory.   (And who knows, maybe you want to make Julienne fries!)   There are also Perl frameworks and JS frameworks that have been crafted to work well together, with fairly high-level support on the Perl side for doing complicated things on the JS side.   Lotsa things to think about, mebbe.