WordPress.org

Support

Support » How-To and Troubleshooting » urlencode issue, not translating to Twitter (or anywhere)

urlencode issue, not translating to Twitter (or anywhere)

  • I’m using a simple TweetThis link with the_permalink and the_title and encoding both, but the output is still getting messed up.

    Here’s the code:

    <a href="http://www.twitter.com/home?status=Reading:%20<?php urlencode(the_title()); ?>%20-%20<?php the_permalink(); ?>">TweetThis</a>

    Here’s the output:

    Reading:%20This%20Is%20A%20Sample%20Title%20to%20Display%20My%20Issue%20-%20http://myblogurl.com/this-is-a-sample-title-to-display-my-issue.html

    What am I missing?

Viewing 1 replies (of 1 total)
  • Did you have any luck with this?
    If I don’t urlencode, but just sub out spaces with +

    $twitterMessage = str_replace(” “, ‘+’, $twitterMessage);

    that fixes my spaces, but extra characters like ‘ or : still come up garbled in FF. OK in Safari, oddly enough.

Viewing 1 replies (of 1 total)
  • The topic ‘urlencode issue, not translating to Twitter (or anywhere)’ is closed to new replies.
Skip to toolbar