Solved

ampersand problem

Posted on 2011-09-18
2
573 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
acbxyz earned 500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses
Course of the Month10 days, 1 hour left to enroll

624 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