The Web Standards Project likes a little bit of Perl I wrote.
Re:the script
gav on 2004-04-09T21:04:10
It just needed a %retab. Looks much neater now, darn tabs.
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
Juerd on 2004-04-09T21:34:44
RFC 2396 calls it "Escaped Encoding" (2.4.1).
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.