473,325 Members | 2,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Parse problem.

I have a problem that php removes the + char. When i type this in the
adres bar:
http://www.test.com/test.php?t=a+b

and when i do a echo in the php page the + char is gone? I also tried
to use the javascript escape function before redirecting but that
won't work eather.

Can someone explein what i'm doing wrong? And how to post a + char ina
other way or something like that..

thanks
mark
Jul 16 '05 #1
2 5831
On 18 Jul 2003 02:46:50 -0700, m_***@hotmail.com (mark) wrote:
I have a problem that php removes the + char. When i type this in the
adres bar:
http://www.test.com/test.php?t=a+b

and when i do a echo in the php page the + char is gone? I also tried
to use the javascript escape function before redirecting but that
won't work eather.

Can someone explein what i'm doing wrong? And how to post a + char ina
other way or something like that..

thanks
mark


I found this in the php-manual:

To encode a '+' (plus) symbol so it ends up as '+' when decoded
automatically by PHP, you have to do this:

rawurlencode(rawurlencode("+"));

If you just call rawurlencode() once, the resulting "%2B" is converted
to '+' before '+' symbols are converted to spaces, which is not very
useful.

Give it a try...
B.

Jul 16 '05 #2
mark wrote:
I have a problem that php removes the + char. When i type this in the
adres bar:
http://www.test.com/test.php?t=a+b

and when i do a echo in the php page the + char is gone?
You are not sending a + character to the script. You are sending a space to
the script. Special characters like spaces get encoded so that they are
safe for transport across HTTP. Your script is seeing the data you sent
it, not the raw encoded form.

When you create links with non-hardcoded data in the query string, make sure
you run urlencode() over the data you are supplying:

echo("http://www.example.com/test.php?t=" . urlencode($data));

(Also, somebody owns the test.com domain, example.com is reserved
specifically for this purpose).

I also tried
to use the javascript escape function before redirecting but that
won't work eather.


Client-side scripting is unreliable. Plenty of people have javascript
unavailable, for all sorts of reasons.
--
Jim Dabell

Jul 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: | last post by:
Hi, I need to read a big CSV file, where different fields should be converted to different types, such as int, double, datetime, SqlMoney, etc. I have an array, which describes the fields and...
8
by: Spartanicus | last post by:
The document at http://homepage.ntlworld.com/spartanicus/custom_dtd.htm uses a custom DTD, the w3c validator validates it but with this warning: "Unknown Parse Mode! The MIME Media Type...
2
by: Vittal | last post by:
Hello All, I am trying to compile my application on Red Hat Linux 8 against gcc 3.2.2. Very first file in application is failing to compile. I tried compiling my application on Linux 7.2...
7
by: memememe | last post by:
I need to be able to parse both of these dates with the same method, and return them as a DateTime object. Is there any methods that would do this blindly or do I need to provide the format? Feb...
3
by: Jon Davis | last post by:
The date string: "Thu, 17 Jul 2003 12:35:18 PST" The problem: // this fails on PST DateTime myDate = DateTime.Parse("Thu, 17 Jul 2003 12:35:18 PST"); Help? Jon
19
by: linzhenhua1205 | last post by:
I want to parse a string like C program parse the command line into argc & argv. I hope don't use the array the allocate a fix memory first, and don't use the memory allocate function like malloc....
3
by: slylos | last post by:
I've got a section of code in my app that keeps track of how much time an employee has accrued, which equals out to 1.33 days of PTO per month. I'm trying to store the time accrued so far in an...
5
by: Navid Azimi | last post by:
What's the best way to parse a currency string to a decimal given the possibility of multiple currencies? That is, my numeric string can be ($12.00) or -£12.00; in either case I want -12.00 to be...
4
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Hi I am having a problem formatting a string when the time is in format hh.mm.ss - used in Europe Parse seems ok when the date uses "/" or "." as seperator but I get an exception when time...
1
by: =?Utf-8?B?YXZucmFv?= | last post by:
We have a web service that gets data in xml format. In that Xml data, we parse few date fields that are in this format <data datefield="12/26/2008" timefield="16:33:45" ...> we parse it into a...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.