CodeIgniter Forums
spaces in URLs converted to _ - 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: spaces in URLs converted to _ (/showthread.php?tid=7288)

Pages: 1 2 3 4 5


spaces in URLs converted to _ - El Forum - 04-02-2008

[eluser]AtlantixMedia[/eluser]
Hello all,

I noticed that CI automatically converts spaces in URLs to _. that is, in an url like this:

www.domain.com/main/search/big+city

by echoing the 3rd segment or function parameter from within the Search function, I see that it has been converted to big_city. how do I avoid this?

thanks in advance


spaces in URLs converted to _ - El Forum - 04-03-2008

[eluser]Ryuuzaki92[/eluser]
urlencode()? it converts spaces to and other non-alpha chars to its ascii code


spaces in URLs converted to _ - El Forum - 04-03-2008

[eluser]AtlantixMedia[/eluser]
maybe I didn't make myself clear. this is something that CI does automatically. it converts already urlencoded urls containing spaces (+) to _


spaces in URLs converted to _ - El Forum - 04-03-2008

[eluser]AtlantixMedia[/eluser]
any idea? anyone?


spaces in URLs converted to _ - El Forum - 04-03-2008

[eluser]barbazul[/eluser]
let me tell you that I've done some testing activating and deactivating xss and I haven't come across any scenario where spaces get replaced.

what version of CI are you running?

could you post some code as to illustrate what you're doing?


spaces in URLs converted to _ - El Forum - 04-04-2008

[eluser]AtlantixMedia[/eluser]
I'm running ver 1.5.4

http://www.domain.com/main/search/big+city

where main is a controller, search is a function, and big+city is a parameter. from within the Search function, I echo the parameter passed by the url and instead of printing big city, it prints big_city. I tried with and without urldecode. same result

Code:
<?php

class Main extends Controller {


    function Main()
    {
        parent::Controller();
    }

    function Search($query)
    {
       echo $query;
    }

}
?>



spaces in URLs converted to _ - El Forum - 04-04-2008

[eluser]barbazul[/eluser]
I don't have acces to a web server right now but you should consider upgrading to CI 1.6.1

The tests I've done on 1.6.1 earlier were identical to yours and the spaced weren't replaced


spaces in URLs converted to _ - El Forum - 06-16-2008

[eluser]AtlantixMedia[/eluser]
ok...I finally upgraded to 1.6.2. Still, I'm experiencing the same issue. spaces are replaced with an _

how can I fix this?

thanks


spaces in URLs converted to _ - El Forum - 06-17-2008

[eluser]AtlantixMedia[/eluser]
any idea? anyone? is it possible php.ini has to do with it?


spaces in URLs converted to _ - El Forum - 06-17-2008

[eluser]mglinski[/eluser]
not an issue, a feature.
If you want spaces add a space in the allowed characters config option in the main config file.
-Matt