tags:

views:

25

answers:

1

I have got a simple flex client requesting some data from a php script. I am using URLLoader to pass the parameters to the php and wait for the response. Since the value of the parameter can contain any character, I was using escape function on the flex side to pass the value to the php script. I figured out that flex escape does not work with all the character and php's equivalent urlencode have different results on the same data.

My question is how can I safely pass a string of characters(any) to the php script. One suggestion I got was to use POST instead of GET or to base 64 encode the string but base64 itself does not contain url safe characters...e.g + gets converted to blank in php.

A: 

Use encodeURIComponent for encoding string on a url. It will encode + and other characters in the variable.

this function assumes that it is processing a URI component it treats the special separator characters (; / ? : @ & = + $ , #) as regular text that should be encoded.

Amarghosh