Avatar of Colin Brazier
Colin Brazier
Flag for United Kingdom of Great Britain and Northern Ireland asked on

urlencode not working correctly

Hi all, I know some of you have used Clickatell to send SMS.

I'm trying to send a £ in the URL, but e.g. £40 is received as A£40

I'm doing the urlencode before adding to the URI:


$text_message = html("FROM FOBG, DO NOT REPLY. ".$newfirstname.", as at ".$todays_date.", you owe the club £".$txtAmount.". You have until ".$due_date." to pay.");
echo $text_message;

$text = urlencode($text_message);
echo $text;

Open in new window


I have tried £  htmlentities etc but no luck so far.
PHPHTTP Protocol

Avatar of undefined
Last Comment
Colin Brazier

8/22/2022 - Mon
Arana (G.P.)

Does        £, &Pound, £   all give you the same result?
what happens if you send it just as text body and not as an URL?
Colin Brazier

ASKER
Thanks.  It's hard to test as I can't get a signal so cannot send to myself!
Colin Brazier

ASKER
I think the issue is putting the text string together.

"you owe the club £".$txtAmount.". You have until ".$due_date." to pay"

is received as

"you owe the club £10. You have until 08 April 2020 to pay"

Can't get my head around it!

   C.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Colin Brazier

ASKER
Even clickatell support could not solve this, so I am closing the question.  Thanks again for responding.

Here's clickatell support's advice:

I see your problem, Unicode will not work for dynamic text, as the £ should display correctly without URL encoding in the UK. If you are making use of a third party application I would suggest submitting messages using  HTTP  to avoid any URL encoding issues.
ASKER CERTIFIED SOLUTION
Colin Brazier

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.