darkflame
darkflame

Reputation: 998

Sharing a link (share?url=) with spaces?

Trying to add a sharing function to my site, but GPlus seems to have trouble sharing url's with spaces in them.

Even escaped they dont seem to work. eg; https://plus.google.com/share?url=http://www.google.com/%23test%20test

It only seems to recognize upto before the %20.

Any ideas? Is this a bug? Am I doing something wrong?

The site is rather ajaxy, and in the history tokens would be a pain to need to use non-standard escaping of characters just for google plus.

Upvotes: 2

Views: 589

Answers (1)

BrettJ
BrettJ

Reputation: 6841

I don't think that this is a bug with Google+ but rather its likely intentional because those URLs would need to be double URL encoded because one URL is sharing a second URL, thus your shared URL should be http%3A%2F%2Fwww.google.com%2F%2523test%2Btest

This won't work to create a preview in the share snippet but the URL is correct when it is shared.

All said, you shouldn't use spaces in your URLs because they are considered unsafe, see RFC 1738. You should change your app's URL structure.

Upvotes: 2

Related Questions