locked
Hyperlinks treats %20 differently RRS feed

  • Question

  • If I create a hyperlink like this in Word (using ctrl+k):

    http://example.org/%20%23%26%41

    two strange things happens:

    1) The %41 is translated into A, so that if you look at the hyperlink with ctrl+k you will no longer see %41, but A at the end. I guess this is just fine, as A is an "unreserved character" according to rfc2396. None of the other "escapes" are replaced.

    2) When I click on the link, this is what is sent to the server: http://example.org/ %23%26A.

    Suddenly %20 is "unescaped" and replaced with a space. Why? According to rfc2396, the space is an "excluded character" and should be escaped. It seems like %20 is the only character that is "unescaped" in this fashion.

    Friday, March 21, 2014 11:01 AM

All replies

  • Hi Thomas,

    Thank you for posting in the MSDN Forum.

    Since the issue is more relate to the end-user, I'd like to move it to Word IT pro forum.

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.

    Thanks for your understanding.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, March 24, 2014 5:10 AM
  • Hello,

    Thank you for your question.

    I am trying to involve someone familiar with this topic to further look at this issue.

    Thanks

    George Zhao
    Forum Support
    ________________________________________
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please click "tnfsl@microsoft.com"

    Tuesday, March 25, 2014 8:50 AM
  • "Unsafe characters"
         Why: Some characters present the possibility of being misunderstood within URLs for various reasons. These characters should also always be encoded.
    Character Code
    Points
    (Hex)
    Code
    Points
    (Dec)
    Why encode?
    Space 20 32 Significant sequences of spaces may be lost in some uses (especially multiple spaces)
    Thursday, March 27, 2014 3:34 PM
  • RohitA: I am not sure in what way this explains anything.

    Please note that Word sends spaces unencoded instead of %20 that I have entered in the URL.

    /Thomas O

    Thursday, March 27, 2014 3:39 PM
  • Hi Thomas,

    If you select the URL and toggle the field code (Alt+F9). It will show you the { HYPERLINK "http://example.org/%20%23%26%41"}. The URL encoding is universal and "%20" is referred as a blank space. If you observe the prompt when it appears it shows a blank space instead of "%20".

    Friday, March 28, 2014 2:49 PM
  • I _know_ how url encoding work. My question is why %20 is decoded _when sending the URL to the browser_ but not %23 or any of the other encoded characters. Why is %20 treated in this special way? I can't see any reason for that and I think it wrong. In my view the URL should either be completely encoded according to rfc2396 or it should be completely unencoded.

    /Thomas O

    Friday, March 28, 2014 5:10 PM
  • Hi Thomas,

    I have tried at my end and it appears to be a default behavior for %20 as it is the character seen in all the time.
    This will only be seen with a blank character (%20).

    Regards,

    Tuesday, April 1, 2014 10:00 PM
  • Hi Thomas,

    I have tried at my end and it appears to be a default behavior for %20 as it is the character seen in all the time.
    This will only be seen with a blank character (%20).

    Regards,


    Indeed. This always happens. The question _why_ Word behaves this way. No other program, that I am aware of, works like that.
    Wednesday, April 2, 2014 5:30 AM