[Proto-Scripty] Re: parsing json strips slashes before quotes - can I avoid this?

2008-10-09 Thread suki rosen
"It appears that the transport, in your case, is the javascript source code, which needs escaping. But I'm curious as to how you're "printing" an onclick attribute from javascript to javascript (or rather, why)." I'm dynamically printing javascript functions to the page using ajax - in order to al

[Proto-Scripty] Re: parsing json strips slashes before quotes - can I avoid this?

2008-10-09 Thread pancakes
right - thanks! I was on the phone with someone discussing the problem (which is why it took me a minute to reply) and the basic message he gave me was to play around with \\\' (or as many backslashes as it takes to properly get the string formatted for a couple levels of rendering) but I believ

[Proto-Scripty] Re: parsing json strips slashes before quotes - can I avoid this?

2008-10-09 Thread T.J. Crowder
Hi, I'm off to bed, but since you still haven't posted the JSON data your server is returning, I'll tell you what I'm pretty sure is wrong. Apologies for any lack of clarity, I'm rushing. I suspect your JSON looks like this: Example #1: * * * * { "message": "This is a \'message\' with \"quo

[Proto-Scripty] Re: parsing json strips slashes before quotes - can I avoid this?

2008-10-09 Thread Hector Virgen
I'm still not sure if I'm following you. If the variable has been printed to the browser, then it should be printed in a format that the browser understands (dom element). Dom elements do not need escaping. If the variable is still in variable form, then it does not need escaping. The only time e

[Proto-Scripty] Re: parsing json strips slashes before quotes - can I avoid this?

2008-10-09 Thread suki rosen
"Why are you printing the variable contents instead of using the variables directly?" if the variable has been printed to the browser, then I'm not aware of the difference (between a variable and the value of the variable). I mean, once I swap something out using innerHTML, it doesn't matter if i

[Proto-Scripty] Re: parsing json strips slashes before quotes - can I avoid this?

2008-10-09 Thread T.J. Crowder
Not an example of the string where you're using it, the _actual_ JSON data being returned by your server. You can probably get this by typing the URL of the server-side page into the browser directly, that kind of thing. -- T.J. On Oct 9, 10:11 pm, pancakes <[EMAIL PROTECTED]> wrote: > I listed

[Proto-Scripty] Re: parsing json strips slashes before quotes - can I avoid this?

2008-10-09 Thread pancakes
I listed an actual example above. user description as stored in mysql - 'I\'ll take you down to china town' when I parse the json object the slash is removed, so I print - onclick="function('I'll take you down to china town')" which throws an error. On Oct 9, 5:04 pm, "T.J. Crowder" <[EMAIL PR

[Proto-Scripty] Re: parsing json strips slashes before quotes - can I avoid this?

2008-10-09 Thread T.J. Crowder
> personally, I would consider this a serious drawback to using json - as > opposed to xml, which does not display this behavior. It's not a JSON thing, it's something specific to what you're doing. Can you give us an example of the actual JSON data you're returning from the server? -- T.J. Crow

[Proto-Scripty] Re: parsing json strips slashes before quotes - can I avoid this?

2008-10-09 Thread Hector Virgen
Why are you printing the variable contents instead of using the variables directly? Are you using javascript to print out the onmouseover text, or a server-side language? Can you post some sample code? Thanks -Hector On Thu, Oct 9, 2008 at 1:52 PM, suki rosen <[EMAIL PROTECTED]> wrote: > for exam

[Proto-Scripty] Re: parsing json strips slashes before quotes - can I avoid this?

2008-10-09 Thread suki rosen
for example, here's a user description: 'I'll take you down to china town' I want to print onclick="function('I'll take you down to china town')" or for rollovers onmouseover="tool_tip('I'll take you down to china town', 100);" both of those throw errors. obviously I need it to work for double

[Proto-Scripty] Re: parsing json strips slashes before quotes - can I avoid this?

2008-10-09 Thread Hector Virgen
Maybe I'm not understanding your implementation, but why do the quotes have to be escaped? If you are passing the data to a function, and is already in the form of a variable, then you do not need to escape it. Can you give me an example of a JSON response? -Hector On Thu, Oct 9, 2008 at 1:21 PM,

[Proto-Scripty] Re: parsing json strips slashes before quotes - can I avoid this?

2008-10-09 Thread suki rosen
personally, I would consider this a serious drawback to using json - as opposed to xml, which does not display this behavior. I'm really hoping there's a workaround here, but I feel like I may drop prototype in favor of a library that has better xml support. > > On Thu, Oct 9, 2008 at 3:53 PM,

[Proto-Scripty] Re: parsing json strips slashes before quotes - can I avoid this?

2008-10-09 Thread suki rosen
I am passing the data as arguments to javascript functions (like onclick="hopefully_escaped_data_from_server") I also have rollover functions that take these descriptions as arguments. Am I missing something??? thanks s On Thu, Oct 9, 2008 at 3:53 PM, Hector Virgen <[EMAIL PROTECTED]> wrote: > I

[Proto-Scripty] Re: parsing json strips slashes before quotes - can I avoid this?

2008-10-09 Thread Hector Virgen
Is there a reason you need the data to remain escaped while being used by javascript? Unless your javascript is interacting directly with the database, you should not need to keep your data escaped. Once javascript is done with the data, and sends it back to the server, the server should then re-es