WordPress.org

Ready to get started?Download WordPress

Forums

urlencode issue, not translating to Twitter (or anywhere) (2 posts)

  1. chazbeaner
    Member
    Posted 5 years ago #

    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?

  2. saintlukas
    Member
    Posted 5 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic