Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7072097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:46:02+00:00 2026-05-28T05:46:02+00:00

I’m using the twitter custom share button ‘Build your own tweet button’ (https://dev.twitter.com/docs/tweet-button). The

  • 0

I’m using the twitter custom share button ‘Build your own tweet button’ (https://dev.twitter.com/docs/tweet-button).
The documentation says that I have to use the query parameters to pass on params.

PROBLEM: Twitter is encoding the text param wrong when I pass it a URL encoded string. A comma (,) is displayed as %252C in the tweet message. Other chars are also wrong encoded.

I use PHP url encode (http://php.net/manual/en/function.urlencode.php) to prepare the string for the call.

$text = urlencode("I just backed ". $project->getTitle().", an amazing new mobile app, on appbackr, where anyone can back mobile apps");

Then I build the twitter link:

'http://www.twitter.com/share?url='.urlencode($projectUrl).'&via='.$via.'&text='.$text.'&related='.$user->getTwitterProfileName()

The final twitter url call is:

http://www.twitter.com/share?url=http%3A%2F%2Flocalhost%2Fapp%2Fbig-top-ballet&via=appbackr&text=I+just+backed+Big+Top+Ballet%2C+an+amazing+new+mobile+app%2C+on+appbackr%2C+where+anyone+can+back+mobile+apps&related=philippberner

As soon as the page opens in the browser (Chrome and Firefox) twitter redirects the URL to:

https://twitter.com/intent/tweet?related=philippberner&text=I+just+backed+Big+Top+Ballet%252C+an+amazing+new+mobile+app%252C+on+appbackr%252C+where+anyone+can+back+mobile+apps&url=http%253A%252F%252Flocalhost%252Fapp%252Fbig-top-ballet&via=appbackr

This displays the following message in the tweet box:

I just backed Big Top Ballet%2C an amazing new mobile app%2C on appbackr%2C where anyone can back mobile apps via @appbackr

It converts Top+Ballet%2C+an+amazing to Top+Ballet%252C+an+amazing. The comma is displayed properly when I manually change %252C to %2C in the twitter URL.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:46:03+00:00Added an answer on May 28, 2026 at 5:46 am

    Actually, it has nothing much to do with url encoding.

    It actually works with urlencode, with rawurlencode, or even without url encoding
    Try the following URLs on opening a new tab.

    With urlEncode: http://twitter.com/share?url=http%3A%2F%2Fwww.appbackr.com%2Fapp%2Fglass-ceiling&via=appbackr&text=I+just+backed+Glass+Ceiling%2C+an+amazing+new+mobile+app%2C+on+appbackr%2C+where+anyone+can+back+mobile+apps&related=

    With rawurlEncode: http://twitter.com/share?url=http%3A%2F%2Fwww.appbackr.com%2Fapp%2Fglass-ceiling&via=appbackr&text=I%20just%20backed%20Glass%20Ceiling%2C%20an%20amazing%20new%20mobile%20app%2C%20on%20appbackr%2C%20where%20anyone%20can%20back%20mobile%20apps&related=

    Without urlEncode: http://twitter.com/share?url=http%3A%2F%2Fwww.appbackr.com%2Fapp%2Fglass-ceiling&via=appbackr&text=I just backed Glass Ceiling, an amazing new mobile app, on appbackr, where anyone can back mobile apps&related=

    The trick actually lies in using twitter.com instead of http://www.twitter.com. Not sure why there is a difference and it does not seem to be documented anywhere in twitter’s documentation nor in google’s search results. Although to be fair, Twitter’s documentation did point to twitter.com and not http://www.twitter.com.

    As always, it is definitely best practice to always urlencode the text even though it works without url encoding.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.