Escaping output but leaving & alone

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Escaping output but leaving & alone

Tom Misilo

Hello,

 

Is there a way to escape the output for the Notes field, but leave the & alone that is coming from the ILS? In the attached example it is changing a & in the ILS to & and displaying that.

 

Thanks,

 

Tom


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Vufind-tech mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vufind-tech

SnipImage.JPG (45K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Escaping output but leaving & alone

Demian Katz

The most likely explanation for what you are seeing is double-encoding. Is it possible that your ILS driver is running htmlspecialchars() or htmlentities() on the text prior to sending it back to VuFind, which in turn is causing the double-escape when the view template applies the standard $this->escapeHtml() to the string? Or is it possible that the note is actually being stored with the HTML entity in place in your ILS database? If that’s the case, you might actually want to add logic in the ILS driver to unescape the string with something like htmlspecialchars_decode() prior to sending it out to VuFind – VuFind is not designed to expect HTML in this context.

 

I hope this is helpful, but please let me know if there is more I can do to assist you!

 

- Demian

 

From: Tom Misilo [mailto:[hidden email]]
Sent: Wednesday, February 15, 2017 9:05 AM
To: [hidden email]
Subject: [VuFind-Tech] Escaping output but leaving & alone

 

Hello,

 

Is there a way to escape the output for the Notes field, but leave the & alone that is coming from the ILS? In the attached example it is changing a & in the ILS to & and displaying that.

 

Thanks,

 

Tom


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Vufind-tech mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vufind-tech
Loading...