0

I have a URL that with spaces and # in it that I escape using URI::Escape to get the following.

https://copy.com/1rsdM7TvVcLfGebc/name%20with%20space%20and%20%23%20in%20it.jpg?

Note: In the original page from where I copied the above clicking the link doesn't work. The HTML from that page is shown here.

<a href=3D"https://copy.com/1rsdM7TvVcLfGebc/name%20with%20space%20and%20%23=
%20in%20it.jpg?source=3Dbsf" style=3D"color: white; font-weight: =
bold;">name with space and # in it.jpg</a>

As you can see # is correctly encoded as %23. The problem is when I click the link the browsers don't retain it as %23 but encode it to # and prevent me from taking to the destination. This is how the link looks in the browser. You can see that after # the spaces are not rendered as %20 either. The behavior is different in other browsers and none of them works.

https://www.copy.com/s/1rsdM7TvVcLfGebc/name%20with%20space%20and%20# in it.jpg

When I manually replace # with %23 in the browser and push enter it correctly takes me to the page.

What's going on here?

3
  • why is there 3D before the quotes? Otherwise the url looks fine. Commented Apr 17, 2013 at 9:10
  • 1
    This is QP encoding used in MIME, it looks like Mir neglected to properly decode an email message. Commented Apr 17, 2013 at 9:17
  • The URI in the HTML snipped does not match the URI you're actually trying to reach, containing as it does extraneous spaces and =s. As @daxim suggests, one of your previous transcoding steps was bungled. Commented Apr 22, 2013 at 22:11

2 Answers 2

1

Not a Perl problem. The redirect on the Web host is broken! Compare:

Sign up to request clarification or add additional context in comments.

Comments

0

Don't rely on its automatic URL encoding. You can force your URLs to encode/decode every time you need to use them.

You can use uri_escape() and uri_unescape() functions for this purpose.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.