Welcome! » Log In » Create A New Profile

Need to allow & in URL query strings

Posted by Jim Donnell 
Jim Donnell
Need to allow & in URL query strings
August 31, 2017 02:07AM

I'm using HTMLPurifier to clean my data before inserting it into our database but I need to allow URLs with query string parameters such as:

Here's some text that goes in the database and here's a url: http://www.somedomain.com?a=1&b=2

HTMLPurifier changes the URL to:


which means that b=2 is not passed when the person clicks on the URL (or copies and pastes it - I sometimes make them href links depending on how they are going to be used.)

Any suggestions on how to make this work would be GREATLY appreciated!


Jim Donnell
Re: Need to allow & in URL query strings
August 31, 2017 02:11AM

Well -that post didn't work because the "Ampersand"amp; that HTMLPurifier substitutes in got taken out of the post I assume by HTMLPurifier...

Hopefully people will understand the problem...


Re: Need to allow & in URL query strings
September 01, 2017 12:27AM

Is your database JUST urls, or is it HTML with URLs int?


HTML input is enabled. Make sure you escape all HTML and angled brackets with < and >.

Auto-paragraphing is enabled. Double newlines will be converted to paragraphs; for single newlines, use the pre tag.

Allowed tags: a, abbr, acronym, b, blockquote, caption, cite, code, dd, del, dfn, div, dl, dt, em, i, ins, kbd, li, ol, p, pre, s, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var.

For inputting literal code such as HTML and PHP for display, use CDATA tags to auto-escape your angled brackets, and pre to preserve newlines:

Place code here

Power users, you can hide this notice with:

.htmlpurifier-help {display:none;}