[Proto-Scripty] Re: Possible BUG: IE8: Object::stringify
Hi, you are absolutly right. thanks. i guess my problem has to be fixed on the server side. thanks. tom On 21 Nov., 16:59, "T.J. Crowder" wrote: > Hi, > > On Nov 21, 3:01 pm, tom tomsen wrote: > > > On Windows XP with Internet Explorer 8, I came across the following > > situation. (http://jsfiddle.net/tCKrt/) > > > var data = {name: 'öäöä'}; > > Object.toJSON(data); > > > Every Browser returns "öäöa" except IE8 returns (something like) > > "\u080\u898". > > (Specifically, "\u00f6\u00e4\u00f6\u00e4".) > > It comes to the same thing, "öäöä" and "\u00f6\u00e4\u00f6\u00e4" are > *exactly* the same string. The latter is written with Unicode escape > sequences, the former with literal Unicode characters. Check this > out:http://jsbin.com/ecojun > > On Chrome, you see this: > * * * * > d1.name: öäöä > {"name":"öäöä"} > d2.name: öäöä > d1.name === d2.name? true > * * * * > > On IE8, you see this: > * * * * > d1.name: öäöä > {"name":"\u00f6\u00e4\u00f6\u00e4"} > d2.name: öäöä > d1.name === d2.name? true > * * * * > > Note the last line. > > > To fix that Problem I had to modify Object::stringify(): > > > function stringify(object) { > > var string = JSON.stringify(object); > > return unescape(string.replace(/\\u/g, '%u')); > > } > > Well first, there is no problem, and thus no need for a fix. :-) IE8 > just uses escape sequences rather than literal characters. > > But secondly, your fix will tend to mess up anything in your string > that starts with a '%' and is followed by 2-4 hex digits. Separately, > `escape` and `unescape` were deprecated years ago and shouldn't be > used. If you really, really want to use Unicode literals, you'd want: > > function stringify(object) { > var string = JSON.stringify(object); > return string.replace(/\\u([0-9A-Za-z]{2,4})/g, function(m, c0) { > return String.fromCharCode(parseInt(c0, 16)); > }); > > } > > ...or similar. > > HTH, > -- > T.J. Crowder > Independent Software Engineer > tj / crowder software / com > www / crowder software / com -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Textarea as a container
I tried using a textarea as the container for Ajax.updater without luck. I presume I need to write the js to take the response and put it in the textarea, but the API just doesn't give me enough detail to use Ajax.request to do that. The returned data is plain text. A bit of assistance would be appreciated. -- Bill Drescher william {at} TechServSys {dot} com -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] Textarea as a container
From the top of my head and totally untested: new Ajax.Request('http://url-you-want-to-request', { onSuccess: function(transport) { $('id-of-your-textarea').setValue(transport.responseText); } }); David Am 22.11.2011 14:19, schrieb bill: I tried using a textarea as the container for Ajax.updater without luck. I presume I need to write the js to take the response and put it in the textarea, but the API just doesn't give me enough detail to use Ajax.request to do that. The returned data is plain text. A bit of assistance would be appreciated. -- Bill Drescher william {at} TechServSys {dot} com -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] Textarea as a container
On 11/22/2011 8:25 AM, David Behler wrote: From the top of my head and totally untested: new Ajax.Request('http://url-you-want-to-request', { onSuccess: function(transport) { $('id-of-your-textarea').setValue(transport.responseText); } }); David Thanks David, that's easy enough. -- Bill Drescher william {at} TechServSys {dot} com -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] Textarea as a container
Yes, but ONLY* if the two URLs share a common host (and protocol). Google 'Same Origin Policy' for more gory details. Walter * Absent some other trust framework with "allowed" endpoints. On Nov 22, 2011, at 8:25 AM, David Behler wrote: > From the top of my head and totally untested: > > new Ajax.Request('http://url-you-want-to-request', { > onSuccess: function(transport) { > $('id-of-your-textarea').setValue(transport.responseText); > } > }); > > David > > Am 22.11.2011 14:19, schrieb bill: >> I tried using a textarea as the container for Ajax.updater without luck. >> I presume I need to write the js to take the response and put it in the >> textarea, but the API just doesn't give me enough detail to use Ajax.request >> to do that. >> >> The returned data is plain text. >> >> A bit of assistance would be appreciated. >> >> -- >> Bill Drescher >> william {at} TechServSys {dot} com >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Prototype & script.aculo.us" group. >> To post to this group, send email to >> prototype-scriptaculous@googlegroups.com. >> To unsubscribe from this group, send email to >> prototype-scriptaculous+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/prototype-scriptaculous?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Prototype & script.aculo.us" group. > To post to this group, send email to prototype-scriptaculous@googlegroups.com. > To unsubscribe from this group, send email to > prototype-scriptaculous+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.