Welcome Guest, Not a member yet? Register   Sign In
Encoded url rejected by CI
#1

[eluser]Exangelus[/eluser]
Hi all,

I'm having an issue with passing raw encoded strings in a url for ajax requests.
I have a config file with a multidimensional array with references to language files.
The key's from one array are unfortunanely neccesary to be real words (short sentenes).

For example: $config['options'] = array($CI->lang->line('options_services') => array()
with the last array containing specific data for that key (rather obvious :p)

Now I show an list of all the keys of the main array in a multiselect, when users click an option I perform an ajax request to fill a second multiselect (the second array in the $config['options'] array).
To make sure the ajax reqeusts are valid url's I use rawurlencode() and rawurldecode(), I don not use the normal urlencode so I don't need to allow plus signs in urls for the spaces.
Most requests work but one doesn't, it contains a encoded comma:

[Image: url.jpg]
(I had to make an image of the damn thing because the forum automatically decoded the encoded parts lol :p)

The nl/ in the url is the language setting, options => controller, request => function.
It should output an JSON object that is read by the ajax function but now I get a 400 because CI rejects the url.
When I try removing the , (which is the comma) it does work so for some reason the , isn't allowed but all three characters are allowed by the default regexp from CI: 'a-z 0-9~%.:_\-'

Anyone got any suggestions?

Thanks in advance!




Theme © iAndrew 2016 - Forum software by © MyBB