NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
the script (Score:2)
Anyway, I think encode_url is a bad name for a function that does not URL-encode (i.e. the %-thing). It does not even have anything to do with URLs. In fact, I would not have used a separate sub for it.
But, as always, it works and it serves a purpose. As does most software.
Re:the script (Score:2)
The reason it's called encode_url is because it encodes the entities in a url. If it was going to do the %-thing, it would be escaping (using URI::Escape). At least that's how I distinguish between the two things, I could be wrong.
Re:the script (Score:2)
Which means some people call it escaping, some call it encoding. Perlfaq9 calls it encoding, URI::Escape calls it escaping.
The thing is exactly the same with HTML Entities: it is escaping AND encoding. Encoding because it changes in a way that can be reversed, escaped because most text is as it is and an escape character (% in a URI, & in HTML) is used to introduce an encoded octet/character..
I'd expect a sub called encode_url to URI-encode because of the "url" in the name. I would have called this sub "reencode_entities" because all it does is "encode_entities(decode_entities($foo))". It is not URL-specific so "url" should not be in the name.
Reply to This
Parent