Encoded url rejected by CI - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Encoded url rejected by CI (/showthread.php?tid=39793) |
Encoded url rejected by CI - El Forum - 03-21-2011 [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: (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! |