Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ampersand problem

Posted on 2011-09-18
2
Medium Priority
?
578 Views
Last Modified: 2012-05-12
Hi all. I have noticed a strange behavior of a my application. I use TIdHTTP in Delphi 7 to contact a php page on my server. Since parameters to send are in a StringList and I use Get method, I build url this way

url := 'http://mysite.com/mypage.php?' + '&0=' + TIdURI.ParamsEncode(sl[0]) + + '&0=' + TIdURI.ParamsEncode(sl[1]); and so on...

The problem is that ampersand disappears and if I do a Showmessage to see the builded url I have something like:

'http://mysite.com/mypage.php?param1=abcparam2=def

and obviiously get call fails.

Any idea?
0
Comment
Question by:Marco Gasi
2 Comments
 
LVL 10

Accepted Solution

by:
acbxyz earned 2000 total points
ID: 36555964
If the first letter after your wanting ampersand gets underlined, this issue is from showmessage(). An apersand is often used to declare the coming letter as shortcut. If you want to debug your url with showmessage() you should use
ShowMessage(StringReplace(url, '&', '&&', [rfReplaceAll]));

Open in new window


However this should not affect your http engine.
0
 
LVL 31

Author Comment

by:Marco Gasi
ID: 36556103
Thanks, acbxyz. You're right: doubling ampersands makes them to appear ion the ShowMessage but this doesn't affect the http engine. Now I'll have to understand why something worked fine since some week ago now it fails :-(
I'm going to give you points since you have solved the ampersand problem.

Thanks.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question