🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
16 messages
16 total messages Started by Hamid Mon, 10 Apr 2006 11:07
Using URLEncode
#2512
Author: Hamid
Date: Mon, 10 Apr 2006 11:07
10 lines
1159 bytes
How can I use the URLEncode method of TIdURI component? 
I am using the method like this:

AnsiString string;
 
TIdURI *idUri = new TIdURI("");
string = idUri->URLEncode(__classid(TIdURI), "http://domain.com?text=text1 + text2");

But it returns the same character as the input string. It does not encode it. Why?
Re: Using URLEncode
#2515
Author: Remy Lebeau (TeamB)
Date: Mon, 10 Apr 2006 18:25
24 lines
1651 bytes
"Hamid" <hrz_mir@Yahoo.com> wrote in message
news:443a3c6c$1@newsgroups.borland.com...

> TIdURI *idUri = new TIdURI("");
> string = idUri->URLEncode(__classid(TIdURI), "http://domain.com?text=text1
+ text2");

URLEncode is a static method, you do not need to create an instance of the
class in order to use it:

    string = TIdURI::URLEncode(__classid(TIdURI),
"http://domain.com?text=text1 + text2");

> But it returns the same character as the input string. It does not encode
it. Why?

Which version of Indy are you actually using?  The debate over whether
spaces are encoded or not has been re-visited several times before.  Some
versions of Indy did encode spaces.  Some did not.  The current snapshot of
Indy 9 does.


Gambit
Re: Using URLEncode
#2523
Author: Hamid
Date: Tue, 11 Apr 2006 05:39
9 lines
1090 bytes
I had used the static method before getting an instance and it did not work.

string = TIdURI::URLEncode(__classid(TIdURI),
"http://domain.com?text=text1 + text2");

>Which version of Indy are you actually using?

I am using Indy 10 integrated with BDS2006.
Re: Using URLEncode
#2524
Author: Remy Lebeau (TeamB)
Date: Tue, 11 Apr 2006 05:54
21 lines
1528 bytes
"Hamid" <hrz_mir@Yahoo.com> wrote in message
news:443b411a$1@newsgroups.borland.com...

> I had used the static method before getting an instance and it did not
work.

Just saying it does not work says nothing about the actual problem you have
with it.

> >Which version of Indy are you actually using?
>
> I am using Indy 10 integrated with BDS2006.

Did you upgrade to the latest 10.1.5 snapshot?  In any case, URLEncode()
does encode spaces in Indy 10.  So what EXACTLY are you having a problem
with?  Please provide an actual example of what you are seeing, and you are
expecting to see instead.


Gambit
Re: Using URLEncode
#2525
Author: Hamid
Date: Tue, 11 Apr 2006 06:03
2 lines
981 bytes
Apparently, Indy 9 has few bugs. Is it possible to install and use Indy 9 in BDS2006?
Re: Using URLEncode
#2426
Author: Hamid
Date: Tue, 11 Apr 2006 06:14
11 lines
1507 bytes
Thanx for your reply. In fact, I had a code written in BCB6.0 (Indy 8.0) and I am upgrading it to BDS2006. I am calling the Get method of the TIDHttp and I have to encode the url. In BCB6.0 an instance of TNMUrl did it which is not supported any more:

nmUrl->InputString = myUrl + myParameters;
encodedUrl = nmUrl->Encode;

and in BDS2006 (Indy 10) I changed my code to:

encodedUrl = TIdURI::URLEncode(__classid(TIdURI), "http://domain.com?text=text1 + text2");

Maybe I am selecting and using the URLEncode method mistakenly.
Re: Using URLEncode
#2428
Author: Remy Lebeau (TeamB)
Date: Tue, 11 Apr 2006 07:27
16 lines
1418 bytes
"Hamid" <hrz_mir@Yahoo.com> wrote in message
news:443b4951$1@newsgroups.borland.com...

> In fact, I had a code written in BCB6.0 (Indy 8.0) and I am upgrading it
to BDS2006.

That is a very large leap.

> I am calling the Get method of the TIDHttp and I have to encode the url.

Again I ask, what is the EXACT problem you are having with it?  What you do
EXPECT it to return?  What does it ACTUALLY return?


Gambit
Re: Using URLEncode
#2427
Author: Remy Lebeau (TeamB)
Date: Tue, 11 Apr 2006 07:28
11 lines
1217 bytes
"Hamid" <hrz_mir@Yahoo.com> wrote in message
news:443b46c0$1@newsgroups.borland.com...

> Is it possible to install and use Indy 9 in BDS2006?

BDS 2006 ships with both Indy 9 and 10.  But Indy 10 is not officially
available for C++ at the moment.


Gambit
Re: Using URLEncode
#2429
Author: Hamid
Date: Tue, 11 Apr 2006 08:09
6 lines
1420 bytes
I saw the both folders (Indy10 and Indy9) but in available packages of the project, only Indy 10 (Core and Protocoles) are available. How can I change them? The Include path can be shifted easily from Indy10 to Indy9, but which packages (bpl files) in the \Bin directory are for Indy9? 

P.S. I have modified some headers of the Indy10 in order to use it without compile time errors. That's why I can use it in BCB2006.

thanx again.
Re: Using URLEncode
#2430
Author: Hamid
Date: Tue, 11 Apr 2006 08:11
8 lines
1303 bytes
>Again I ask, what is the EXACT problem you are having with it?  What you do
>EXPECT it to return?  What does it ACTUALLY return?

I passed this string as input:
"http://domain.com?text=text1 + text2"

and it returns "http://domain.com?text=text1 + text2/" as output. No encoding for spcace and "+" sign.
Re: Using URLEncode
#2437
Author: Remy Lebeau (TeamB)
Date: Tue, 11 Apr 2006 17:07
18 lines
1553 bytes
"Hamid" <hrz_mir@Yahoo.com> wrote in message
news:443b6445$1@newsgroups.borland.com...

> I saw the both folders (Indy10 and Indy9) but in available
> packages of the project, only Indy 10 (Core and Protocoles) are available.

Indy 10 uses three packages.  There is a System package that is required
along with the Core and Protocols packages.

> I have modified some headers of the Indy10 in order to use it without
compile time errors.

C++ support is currently being worked on.  Manual edits will not be needed
once it has been released.


Gambit
Re: Using URLEncode
#2439
Author: Hamid
Date: Tue, 11 Apr 2006 17:42
10 lines
1339 bytes
Thanx Remy,
and what do you think of URLEncode? Do you have the same problem when you try to use it?

I passed this string as input:
"http://domain.com?text=text1 + text2"

and it returns "http://domain.com?text=text1 + text2/" as output. No encoding for spcace and "+" sign.

Thanx again,
Re: Using URLEncode
#2438
Author: Remy Lebeau (TeamB)
Date: Tue, 11 Apr 2006 17:48
19 lines
1634 bytes
"Hamid" <hrz_mir@Yahoo.com> wrote in message
news:443b64ac$1@newsgroups.borland.com...

> No encoding for spcace and "+" sign.

'+' is not supposed to be encoded in the query portion.of the URL.

As for the spaces, they are guaranteed to always be encoded, so there is no
way that they can be ignored.

As for the '/' being appended at the end of your URL, that is because you do
not have any '/' after the domain in your input URL.  TIdURI expects that,
ie:.

    "http://domain.com/?text=text1 + text2"


Gambit
Re: Using URLEncode
#2440
Author: Remy Lebeau (TeamB)
Date: Tue, 11 Apr 2006 22:27
10 lines
1245 bytes
"Hamid" <hrz_mir@Yahoo.com> wrote in message
news:443bea81$1@newsgroups.borland.com...

> and what do you think of URLEncode?

I already answered that.


Gambit
Re: Using URLEncode
#2442
Author: Hamid
Date: Wed, 12 Apr 2006 05:54
2 lines
1150 bytes
Thanx. It worked. So how can I force the URLEncode to encode the special signes such as the "+" sign to "%2B"?
Re: Using URLEncode
#2444
Author: Remy Lebeau (TeamB)
Date: Wed, 12 Apr 2006 10:14
14 lines
1601 bytes
"Hamid" <hrz_mir@Yahoo.com> wrote in message
news:443c95fe$1@newsgroups.borland.com...

> So how can I force the URLEncode to encode the special
> signes such as the "+" sign to "%2B"?

Like I told you before, '+' is not suposed to be encoded, so Indy doesn't do
encode it.  If you want to encode it anyway, then the only way is to
re-write TIdURI's source code and then recompile Indy.  Or else encode it
manually.


Gambit
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads