What standard produced hex-encoded characters with an extra "25" at the front?

31,674

Solution 1

%25 is actually a % character. My guess is that the external website is URLEncoding their output twice accidentally.

If that's the case, it is safe to replace %25 with % (or just URLDecode twice)

Solution 2

The ASCII code 37 (25 in hexadecimal) is %, so the URL encoding of % is %25.

It looks like your data got URL encoded twice: , -> %2C -> %252C

Substituting every %25 for % should not generate any problems, as an actual %25 would get encoded to %25252525.

Share:
31,674

Related videos on Youtube

Will Martin
Author by

Will Martin

delete me

Updated on January 23, 2020

Comments

  • Will Martin
    Will Martin over 4 years

    I'm trying to integrate with ybp.com, a vendor of proprietary software for managing book ordering workflows in large libraries. It keeps feeding me URLs that contain characters encoded with an extra "25" in them. Like this book title:

    VOLATILE KNOWING%253a PARENTS%252c TEACHERS%252c AND THE CENSORED STORY OF ACCOUNTABILITY IN AMERICA%2527S PUBLIC SCHOOLS.
    

    The encoded characters in this sample are as follows:

    %253a = %3A = a colon
    %252c = %2C = a comma
    %2527 = %27 = an apostrophe (non-curly)
    

    I need to convert these encodings to a format my internal apps can recognize, and the extra 25 is throwing things off kilter. The final two digits of the hex encoded characters appear to be identical to standard URL encodings, so a brute force method would be to replace "%25" with "%". But I'm leary of doing that because it would be sure to haunt me later when an actual %25 shows up for some reason.

    So, what standard is this? Is there an official algorithm for converting values like this to other encodings?

    • Mouse Food
      Mouse Food over 12 years
      Looks like its double-encoded. %25 = %, so decode once %253A becomes %3A then decode again to ':' How you do this is language specific.
  • austinmarton
    austinmarton over 6 years
    Useful to mention "double encoding" is the search term for more info