简体   繁体   English

双重网址编码问题PHP

[英]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: 我正在尝试编码(使用php urlencode)这个测试标题:

Quiz: Are The'se Com!!ments Ab_+=&out the 2001 iPod or 2010 iPad? 测验:The'se Com !! ments是Ab _ + =&out 2001 iPod或2010 iPad吗?

and then submit it to twitter using following url (user clicks 'share this content' link on my website): 然后使用以下网址将其提交给Twitter(用户点击我网站上的“共享此内容”链接):

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 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 +或+ 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? 您是否尝试过不带urlencode的代码?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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