chombium Posted October 29, 2007 Share Posted October 29, 2007 Hi, I have a php script which gets several parameters over $_GET. For one of them I need to send URL encoded ASCII special characters. For example: %00 (url encoded NULL character). %1B%40 (url encoded Euro sign) When I'm trying to send something the php it self does some conversion and I can not send the characters which have two byte code (heigher than 127), ie %00%1b%40 The conversion that php makes is "%00" => "\0" Without doing any conversion, when I try echo $_GET["param"] it prints the "\0". Is there a way to get the value of the variable in "raw format", to be the same as it was put in the URL as a GET parameter? BR, chombium Quote Link to comment https://forums.phpfreaks.com/topic/75180-sending-00-as-a-part-of-get-parameter/ Share on other sites More sharing options...
Orio Posted October 29, 2007 Share Posted October 29, 2007 urlencode() Orio. Quote Link to comment https://forums.phpfreaks.com/topic/75180-sending-00-as-a-part-of-get-parameter/#findComment-380201 Share on other sites More sharing options...
chombium Posted October 29, 2007 Author Share Posted October 29, 2007 Thanks for the reply. You saved me I could see that $_GET does something with the variables, but I was not sure what. I've created a test script: <?php echo "original get: ".$_GET["var"]." raw encoded: ".rawurlencode($_GET["var"])."<br/>"; ?> and I called it with http://localhost/test.php?var=%00 I made some test with various special characters and I experienced some strange things when testing with %00 When I tested on PHP4 (4.3.10 and 4.4.2) I experienced some weird PHP behavior: $_GET["var"] was "\0" this was expected, but rawurlencode($_GET["var"]) was "%5C0". The "\" was urlencoded as %5C On PHP5 (5.2.3 and 5.0.3) it worked good $_GET["var"] was "\0" and rawurlencode($_GET["var"]) was "%00". Is this a bug in PHP4? TIA, chombium Quote Link to comment https://forums.phpfreaks.com/topic/75180-sending-00-as-a-part-of-get-parameter/#findComment-380461 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.