Hello,
if I encode a string with an ampersand in it I got an serverside error
(PHP ZEND Framework) because the json string isn''t complete:
In JS the encoding looks like:
var ajaxParameter =
''param={"val":''+$(''val'').getValue().toJSON()
+''}'';
If $(''val'') has the value of e.g.
''test&test''
I got this results:
{"val":"test
in PHP Zendframework
instead of :
{"val":"test&test"}
My PHP code looks like this:
$json = $this->_getParam(''param'',"");
$validationObjekt= Zend_Json_Decoder::decode($json,
Zend_Json::TYPE_ARRAY);
hope you can help me?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Manic Miner
2008-Feb-18 18:28 UTC
Re: toJSON() generates error when encoding a string with "&"
I am seeing exactly the same error. Have you come up with any work arounds at all? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
you got to use the encodeuricomponent function, because in the get string
you got something like
http://www.w3schools.com/jsref/jsref_decodeURIComponent.asp
val= {"val":"test&test
and with and ampersand php think that come other parameter
Elden
On Mon, Feb 18, 2008 at 12:28 PM, Manic Miner
<sdharvey-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> I am seeing exactly the same error. Have you come up with any work
> arounds at all?
> >
>
--
{a human being that was given to fly}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---