[PHP] String handling with special char?
Hi Guys Gals, Sorry to re-post this but I'm still stuck and have had no reply. I receive via HTTP GET a string variable in encoded HEX format, for example; script.php?text=%0A%01%00%B1%B2 My problem is that PHP sees the first occurance of %00 as a field terminator and so anything after it is ignored. How can I access the full string? In C there is an alternative string handling module which can be used (as C also uses it as a terminator). How can I do this with PHP? Please, please, please help if you can. Best wishes, Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] String handling with special char?
just use url_encode() to encode your parameters and then pass them It's just like richard basket problem a few emails behind $parameters = url_encode(error=25); index.htm?$parameters Hope this helps - Original Message - From: Andrew Cowles [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 30, 2001 8:40 AM Subject: [PHP] String handling with special char? Hi Guys Gals, Sorry to re-post this but I'm still stuck and have had no reply. I receive via HTTP GET a string variable in encoded HEX format, for example; script.php?text=%0A%01%00%B1%B2 My problem is that PHP sees the first occurance of %00 as a field terminator and so anything after it is ignored. How can I access the full string? In C there is an alternative string handling module which can be used (as C also uses it as a terminator). How can I do this with PHP? Please, please, please help if you can. Best wishes, Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] String handling with special char?
Hi Frewuill, Thanks for the mail. The parameters are passed from an end user via HTTP GET and on receipt I use urlencode($parametername) but, the parameter only contains data up to the 1st occurance of %00 and then ends. Calling the following code with 'script.php?text=%0A%01%00%B1%B2' would output '%0A%01' only. ? $text=urlencode($text); echo($text); ? Am I missing something in your solution? Any ideas? Best wishes, Andy On Tue, 30 Oct 2001, Frewuill Rodriguez wrote: just use url_encode() to encode your parameters and then pass them It's just like richard basket problem a few emails behind $parameters = url_encode(error=25); index.htm?$parameters Hope this helps - Original Message - From: Andrew Cowles [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 30, 2001 8:40 AM Subject: [PHP] String handling with special char? Hi Guys Gals, Sorry to re-post this but I'm still stuck and have had no reply. I receive via HTTP GET a string variable in encoded HEX format, for example; script.php?text=%0A%01%00%B1%B2 My problem is that PHP sees the first occurance of %00 as a field terminator and so anything after it is ignored. How can I access the full string? In C there is an alternative string handling module which can be used (as C also uses it as a terminator). How can I do this with PHP? Please, please, please help if you can. Best wishes, Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] String handling with special char?
well then you have to work on client side...doing urlenconde after receive parameters is useless. So i guess your client (end user) is not using a html form but sending parameters via HTTP GET as you said.. if you were using a html form you won't have this problem... so if you want to pass the parameters via HTTP GET then you client (end user or whatever) should do a little work like replace % by %25 so i you want to send 'script.php?text=%0A%01%00%B1%B2' what you should send in order to work properly 'script.php?text= %250A%2501%2500%25B1%25B2' Note that all % were changed by %25. I tested it and it worked. Hope this helps - Original Message - From: Andrew Cowles [EMAIL PROTECTED] To: Frewuill Rodriguez [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, October 30, 2001 9:23 AM Subject: Re: [PHP] String handling with special char? Hi Frewuill, Thanks for the mail. The parameters are passed from an end user via HTTP GET and on receipt I use urlencode($parametername) but, the parameter only contains data up to the 1st occurance of %00 and then ends. Calling the following code with 'script.php?text=%0A%01%00%B1%B2' would output '%0A%01' only. ? $text=urlencode($text); echo($text); ? Am I missing something in your solution? Any ideas? Best wishes, Andy On Tue, 30 Oct 2001, Frewuill Rodriguez wrote: just use url_encode() to encode your parameters and then pass them It's just like richard basket problem a few emails behind $parameters = url_encode(error=25); index.htm?$parameters Hope this helps - Original Message - From: Andrew Cowles [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 30, 2001 8:40 AM Subject: [PHP] String handling with special char? Hi Guys Gals, Sorry to re-post this but I'm still stuck and have had no reply. I receive via HTTP GET a string variable in encoded HEX format, for example; script.php?text=%0A%01%00%B1%B2 My problem is that PHP sees the first occurance of %00 as a field terminator and so anything after it is ignored. How can I access the full string? In C there is an alternative string handling module which can be used (as C also uses it as a terminator). How can I do this with PHP? Please, please, please help if you can. Best wishes, Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] String handling with special char?
Thanks Frewuill, You are a STAR! Andy On Tue, 30 Oct 2001, Frewuill Rodriguez wrote: well then you have to work on client side...doing urlenconde after receive parameters is useless. So i guess your client (end user) is not using a html form but sending parameters via HTTP GET as you said.. if you were using a html form you won't have this problem... so if you want to pass the parameters via HTTP GET then you client (end user or whatever) should do a little work like replace % by %25 so i you want to send 'script.php?text=%0A%01%00%B1%B2' what you should send in order to work properly 'script.php?text= %250A%2501%2500%25B1%25B2' Note that all % were changed by %25. I tested it and it worked. Hope this helps - Original Message - From: Andrew Cowles [EMAIL PROTECTED] To: Frewuill Rodriguez [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, October 30, 2001 9:23 AM Subject: Re: [PHP] String handling with special char? Hi Frewuill, Thanks for the mail. The parameters are passed from an end user via HTTP GET and on receipt I use urlencode($parametername) but, the parameter only contains data up to the 1st occurance of %00 and then ends. Calling the following code with 'script.php?text=%0A%01%00%B1%B2' would output '%0A%01' only. ? $text=urlencode($text); echo($text); ? Am I missing something in your solution? Any ideas? Best wishes, Andy On Tue, 30 Oct 2001, Frewuill Rodriguez wrote: just use url_encode() to encode your parameters and then pass them It's just like richard basket problem a few emails behind $parameters = url_encode(error=25); index.htm?$parameters Hope this helps - Original Message - From: Andrew Cowles [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 30, 2001 8:40 AM Subject: [PHP] String handling with special char? Hi Guys Gals, Sorry to re-post this but I'm still stuck and have had no reply. I receive via HTTP GET a string variable in encoded HEX format, for example; script.php?text=%0A%01%00%B1%B2 My problem is that PHP sees the first occurance of %00 as a field terminator and so anything after it is ignored. How can I access the full string? In C there is an alternative string handling module which can be used (as C also uses it as a terminator). How can I do this with PHP? Please, please, please help if you can. Best wishes, Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]