Solved

ampersand problem

Posted on 2011-09-18
2
560 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 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 30

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 Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now