Link to home
Create AccountLog in
Avatar of Colin Brazier
Colin BrazierFlag 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.
Avatar of Arana (G.P.)
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?
Avatar of Colin Brazier

ASKER

Thanks.  It's hard to test as I can't get a signal so cannot send to myself!
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.
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
Avatar of Colin Brazier
Colin Brazier
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account