I'm having trouble getting freelinking to work correctly when linking to nodes that have an ampersand in the title. The link appears onscreen as "Example & Example" rather than "Example & Example" and thus does not lead to the correct node. Ampersands in other text areas appear normally.
Please help -- I have lots of nodes with ampersands in the title! I'm not a developer or programmer, so I have no idea how to deal with this issue...something with escaping HTML characters or entities or some such, right? :)
Thanks in advance.
Comments
Comment #1
eafarris commentedYeah, something like that. Committed a very ugly fix to DRUPAL-4-5, DRUPAL-4-6, and HEAD. Seems to do the trick for me. Thanks for the report! Please verify and close.
Coders: I need some help with this. It just looks so wrong, but all I was able to get to work was rawurlencode(htmlspecialchars(rawurlencode($string))). U. G. L. Y. Any better solutions?
Comment #2
spazfoxThanks for taking a look at this. The fix didn't work for me, however. The ampersand is still appearing as "& amp ;" (w/o the spaces, of course) on screen and when it creates the link.
Comment #3
spazfoxIt seems that this patch for plain-text checking may be relevant to the ampersand issue in the freelinking module. It seems part of the problem is that node titles are stored as plain text, and this patch and the new function it introduces may improve the text handling of freelinking to allow linking to nodes with ampersands in the title...?
Comment #4
spazfoxOkay, so this is really driving me crazy. I discovered part of the problem is a conflict with the URL filter -- if the URL filter is executed before the Freelinking filter, the link appears with the & a m p ; and doesn't work (i.e., it goes to the create a new node page rather than linking to the correct existing node). When I set the URL filter to execute *after* the Freelinking filter, the ampersand appears correctly on screen, but the link still doesn't work (i.e., it still tries to create a new node). In case it matters, when it tries to create a new node it is assigning only the first word as the title. For example, trying to link to a node with the title "Fox & Socks" will result in freelinking attempting to create a new node with the title "Fox".
*sigh*.....I hope this can get corrected soon. I'm trying to use freelinking as a way for users to link to a reference list/bibliography that is written in American Psychological Association (APA) Style, meaning lots of nodes have ampersands in the title (e.g., Fox & Jones, 2004; Smith, Jones, & Adams, 2000)!
Comment #5
eafarris commentedI'm terribly sorry, but I can't reproduce this, with urlfilter firing before or after freelinking, or not there at all. Sorry! Maybe you could give me some more details on your input formats, weights, etc., but with just freelinking or with freelinking and urlfilter, it works for me.
Anyone else see this behavior?
Comment #6
spazfoxI downloaded the version you committed to head (along with the database addition) and everything works now. I was using the version you committed to 4.6 (since I'm using 4.6.2) before. Sorry about that -- I'm rather new to all of this and don't quite understand the distinctions between patches committed to head vs. 4.6 etc.
In case it still matters, the previous version I was using would not work on ampersands even if it was the only filter being used.
Thanks for your help! This is a great module.