I'm trying to use Eagle 5.11 and netget() to get some information from a webpage. The URL contains the string "%2F". When netget() sees that string, it translates it to "%252F". Is there a way to get netget() to leave the characters in a URL alone?
I'm trying to use Eagle 5.11 and netget() to get some information from a webpage. The URL contains the string "%2F". When netget() sees that string, it translates it to "%252F". Is there a way to get netget() to leave the characters in a URL alone?
On 22/02/14 05:45, Dave Vandenbout wrote:
I'm trying to use Eagle 5.11 and netget() to get some information from a
webpage. The URL contains the string "%2F". When netget() sees that
string, it translates it to "%252F". Is there a way to get netget() to
leave the characters in a URL alone?
This modification is a syntactic requirement of URLs. Certain characters
are not legal in a URL and must be escaped. The way this is done is to
convert them to their ASCII code in HEX preceded by the % symbol.
Because of this use of %, the % character itself must be escaped, ending
up as %25.
Now, armed with that knowledge, you will see that your problem is not
that you can't put %2F in the URL but that the URL you want contains a
character which had to be escaped to %2F. The bad news is that there's
no good reason for that because 2F is the ASCII code of '/' - which is
the path separator. So either your URL got broken in translation and the
%2F should become a '/', or it's broken by design in which case you
probably NEED the behaviour you're complaining about.
Thanks for the reply, but you've misunderstood my problem. The URL I'm trying to access has the literal string of "%2F" in it. (I realize this is the escaped code for a '/'. So did the creator of the webpage. That's why he placed the "%2F" in there, and not an actual forward slash.) But I am unable to place a literal of "%2F" into the URL because netget() sees the initial '%' character and escapes it by translating it into "%25", thus giving me a final URL with "%252F" in it.
Now my way out of this would be to place a '/' into the URL and then have netget() translate that into "%2F". But that doesn't happen because a '/' is the path separator (as you pointed out), so netget() just leaves it as a '/' instead of replacing it with "%2F". (That's a good thing, otherwise netget() would escape all the other slashes that actually are path separators in the URL, too.)
So my problem is I can't put "%2F" into the URL directly because netget() translates that to "%252F", and I can't put '/' into the URL because netget() looks at that as the path separator and does not translate it at all so it stays as a '/'.
So, to repeat, I need a way to make netget() stop escaping characters because it's doing it wrong in this specific case.
I'm completely going out on a limb here as I have no way to test this, but have you tried putting a backslash in front of the percent sign? Or what about putting single quotes around the literal '%2F'?
Hi, Doug. Thanks for your suggestions.
I tried the backslash before with the string "\%2F" and netget translates that into "%5C%252F". So netget() is translating the backslash into "%5C" and the percent into "%25".
I tried putting single quotes around it like '%2F' inside the URL string. netget() just translates that into '%252F'. So it just ignores the single quotes and still goes inside to translate the percent sign.
BTW, here's the URL I'm trying to access with netget(): PIC18F14K50-I/SS Microchip Technology | PIC18F14K50-I/SS-ND | DigiKey You'll have to hover over it to see the actual URL. I am able to access this page using Python. I am unable to access the page using netget() with the same URL because of the translation errors.
Ugh. That sucks. (BTW, hovering didn't give me the escaped literals, but copying and pasting into a new tab showed it to me.) I just took a look through the EAGLE release notes to see if there were any changes in newer versions, but I didn't find anything.
I wonder if Jorge has any ideas. I'll ask him in the morning when I follow up with him about a different email message...
Dave Vandenbout wrote on Tue, 25 February 2014 23:18
The URL I'm trying to access has the literal string of "%2F" in it. (I
realize this is the escaped code for a '/'. So did the creator of the
webpage.
That seems to be the real problem here.
--
Web access to CadSoft support forums at www.eaglecentral.ca. Where the CadSoft EAGLE community meets.
Dave Vandenbout scribbled thus:
(http://www.digikey.com/product-detail/en/PIC18F14K50-I%2FSS/PIC18F14K50-I%2FSS-ND/1999472)
Are you sure that the link actually exists ?
Digikey gives me a "404" Page not found.
--
Best Regards:
Baron.
On 02/26/2014 08:19 AM, Baron wrote:
Dave Vandenbout scribbled thus:
(http://www.digikey.com/product-detail/en/PIC18F14K50-I%2FSS/PIC18F14K50-I%2FSS-ND/1999472)
The translation to "%2C2F" is indeed correct behavior. Any ordinary
browser makes the same translation behind the scenes.
If you watch the HTTP traffic, among the request headers will be a line
that starts with "GET", and is followed by the escaped URL. The reason
the "%2F" is there in the first place is because the author did not want
the "/" interpreted as a path separator by the web server - it is
intended to be part of a search term. Since the '%' character is used
as an escape character, it itself had to be translated to %2C.
Are you sure that the link actually exists ?
Digikey gives me a "404" Page not found.
Regarding the above link, I clicked it and Digikey brought me right to
the part without error. I'm using Thunderbird to read the newsgroup,
and Firefox as my default browser.
HTH,
- Chuck
Chuck Huber scribbled thus:
On 02/26/2014 08:19 AM, Baron wrote:
Dave Vandenbout scribbled thus:
(http://www.digikey.com/product-detail/en/PIC18F14K50-I%2FSS/PIC18F14K50-I%2FSS-ND/1999472)
The translation to "%2C2F" is indeed correct behavior. Any ordinary
browser makes the same translation behind the scenes.
If you watch the HTTP traffic, among the request headers will be a
line
that starts with "GET", and is followed by the escaped URL. The
reason the "%2F" is there in the first place is because the author did
not want the "/" interpreted as a path separator by the web server -
it is
intended to be part of a search term. Since the '%' character is used
as an escape character, it itself had to be translated to %2C.
Are you sure that the link actually exists ?
Digikey gives me a "404" Page not found.
Regarding the above link, I clicked it and Digikey brought me right to
the part without error. I'm using Thunderbird to read the newsgroup,
and Firefox as my default browser.
HTH,
- Chuck
Thanks Chuck,
I too am using Firefox. So it didn't interpret it correctly for me
either.
--
Best Regards:
Baron.
Baron scribbled thus:
Dave Vandenbout scribbled thus:
(http://www.digikey.com/product-detail/en/PIC18F14K50-I%2FSS/PIC18F14K50-I%2FSS-ND/1999472)
Are you sure that the link actually exists ?
Digikey gives me a "404" Page not found.
If I cut and paste the link it works properly. Neither Firefox or
Chrome find the page if I just click on the link.
Sorry for the confusion ! Now I understand what is happening.
--
Best Regards:
Baron.