2 Replies - 1059 Views - Last Post: 30 December 2010 - 05:06 AM Rate Topic: -----

#1 althejandro  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 29-June 10

urlencode & and " trouble

Posted 29 December 2010 - 09:51 PM

I'm using an unofficial tweet button for something i'm working on and am using urlencode to convert the text into a query string to send to twitter


$url = "http//twitter.com/?status=";
$qString =  urlencode($tweet);
echo "<a href='$url$qString' id='rtButton'>ReTweet</a>";



if $tweet is something like - hello & goodbye
& gets encoded to %26amp%3B, and gets passed into the query string as %26amp;
the tweet then looks like - hello &amp; goodbye

(same thing happens with "'s, turns into quot; in the actual tweet)

how can I avoid getting the amp; & quot;?

Is This A Good Question/Topic? 0
  • +

Replies To: urlencode & and " trouble

#2 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon



Reputation: 2876
  • View blog
  • Posts: 11,050
  • Joined: 15-July 08

Re: urlencode & and " trouble

Posted 29 December 2010 - 10:42 PM

You could look into the htmlspecialchars_decode function. That should take care of it.
Was This Post Helpful? 1
  • +
  • -

#3 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3569
  • View blog
  • Posts: 10,402
  • Joined: 08-June 10

Re: urlencode & and " trouble

Posted 30 December 2010 - 05:06 AM

View Postalthejandro, on 30 December 2010 - 04:51 AM, said:

how can I avoid getting the amp; & quot;?

the point is that & and " are invalid data characters in an URL, esp. & has a separate meaning (parameter separator)
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1