Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread usage of encodeuricomponent !
Tue, Apr 12 2016 7:15 AMPermanent Link

kamran

Hi

I have these text entries that I wish to use in a url:
line1
line2
body

I wish to encode so that line1 and line2 appear in body on separate lines. eg with cr + line feed

so I use the encodeuricomponent.

body:=encodeURIComponent(line1+'%0D%0A'+line2);

It does not work as expected. I guess I am using it incorrectly !

Whats the correct way to use this ?

Many thanks

Kamran
Tue, Apr 12 2016 7:53 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Kamran,

<< so I use the encodeuricomponent.

body:=encodeURIComponent(line1+'%0D%0A'+line2);

It does not work as expected. I guess I am using it incorrectly ! >>

Yes, you're doing the work of the function, so you're ending up with double-encoding. Just use this:

body:=encodeURIComponent(line1+#13+#10+line2);

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Apr 12 2016 8:00 AMPermanent Link

Matthew Jones

kamran wrote:

> body:=encodeURIComponent(line1+'%0D%0A'+line2);

wouldn't that be

body := encodeURIComponent(line1) + #13#10 + encodeURIComponent(line2);

(might have to adjust to #13 + #10, can't remember)


--

Matthew Jones
Tue, Apr 12 2016 8:13 AMPermanent Link

kamran

Hi Tim

That works great.

Much Appreciated !

Thanks

Kamran

Tim Young [Elevate Software] wrote:

Kamran,

<< so I use the encodeuricomponent.

body:=encodeURIComponent(line1+'%0D%0A'+line2);

It does not work as expected. I guess I am using it incorrectly ! >>

Yes, you're doing the work of the function, so you're ending up with double-encoding. Just use this:

body:=encodeURIComponent(line1+#13+#10+line2);

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Apr 12 2016 8:15 AMPermanent Link

kamran

Yes your solution same as Tim's - works great - thanks  

"Matthew Jones" wrote:

kamran wrote:

> body:=encodeURIComponent(line1+'%0D%0A'+line2);

wouldn't that be

body := encodeURIComponent(line1) + #13#10 + encodeURIComponent(line2);

(might have to adjust to #13 + #10, can't remember)


--

Matthew Jones
Tue, Jul 19 2016 11:38 AMPermanent Link

Trinione

<< encodeURIComponent >>

I need to encode a URL.

Where can this be found:  encodeURIComponent ?
Tue, Jul 19 2016 11:42 AMPermanent Link

Matthew Jones

Trinione wrote:

> encodeURIComponent

uses webdom;

--

Matthew Jones
Tue, Jul 19 2016 11:44 AMPermanent Link

Trinione

<< uses webdom; >>

Yep. Thank you.
Image