Perl Escape::HTML function doesn't escape #?

824 Views Asked by At

Managed to narrow the code down a lot more:

http://pastebin.com/J40Atm9m

Sorry to be a pain but I really thought I had it cracked by using uri_escape in the GetQueryString subroutine but now I'm really out of ideas otherwise I wouldn't ask.

Any insights are much appreciated.

Martin

2

There are 2 best solutions below

0
On BEST ANSWER

HTML::Escape isn't supposed to escape "#" because "#" isn't unsafe for HTML.The problem is that you're not URI-escaping your data before you're putting it into a URI; use URI::Escape for that.

0
On

That is a lot of code. A reduced test case would be helpful.

Rather than read all of it, I'm going to assume that this is what you are doing:

  1. You get raw data
  2. You put raw data in a URI
  3. You encode the URI for HTML
  4. You put the encoded URI in the HTML

If so, then what you missed is this:

You need to encode the data for the URI.