简体   繁体   中英

Double url encoding problem php

Just recently I stumble upon a strange url encoding problem.

I'm trying to encode (using php urlencode) this test title:

Quiz: Are The'se Com!!ments Ab_+=&out the 2001 iPod or 2010 iPad?

and then submit it to twitter using following url (user clicks 'share this content' link on my website):

http://www.twitter.com/home/?status=http://tinyurl.com/2eag89r+Quiz%3A+Are+The%27se+Com%21%21ments+Ab_%2B%3D%26out+the+2001+iPod+or+2010+iPad%3F

But if you will follow that url - you will see that url was double encoded (maybe by browser?) for some reason and some characters (like '!?+_) stay encoded.

How can I solve that encoding problem?

It seems as though your "Share This" code may encode the title on it's own and with you doing it again it gets double encoded.

Have you tried this without your urlencode?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM