Auto_link escaping issues

I’m calling auto_link on a block of HTML-escaped text. It is failing to
correctly link URLs that have multiple GET string variables.

For example:
http://www.google.com/search?hl=en&q=bugzilla&btnG=Google+Search

…is escaped to:
http://www.google.com/search?hl=en&q=bugzilla&btnG=Google+Search

…which auto_link() links as:
<a href=“http://www.google.com/search?hl=en&” name=“830_link”
target="_blank">http://www.google.com/search?hl=en&</a>;q=bugzilla&btnG=Google+Search

(here it is again w/o MY escaping since I’m not sure how this forum
escapes values [PREVIEW OPTION IS NEEDED])
http://www.google.com/search?hl=en&;q=bugzilla&btnG=Google+Search

Has anyone run into this before? Short of not escaping HTML (which
isn’t an option) what can be done to fix this?

Thanks.

Caleb Jones wrote:

For example:
http://www.google.com/search?hl=en&q=bugzilla&btnG=Google+Search

Well, it looks like this forum is doing this correctly. Any
ruby-forum.com dev’s out there that can explain how they are both
escaping HTML and calling auto linking URLs?

Well, it looks like this forum is doing this correctly. Any
ruby-forum.com dev’s out there that can explain how they are both
escaping HTML and calling auto linking URLs?

I had the same problem. Here is a simplified version that worked for me:

    '<a href="' + link + '">' + link_text + '</a>'
  end
end

It doesn’t detect already linked URLs (I didn’t need it) but it allows a
wider range of URLs (ftp://…, for example) and works with HTMLized
URLs (…?foo=1&bar=2…) and some other special case original
version doesn’t seem to detect (http://www.example.com/?foo).


Francesc Rosà s [email protected]
http://strut.ath.cx/
[email protected] (IM)
GPG ID: 0xFC84EFAB

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs