Hi, Does Boost have functions like htmlspecialchars and urlencode (from PHP)? If not, I think they'd make a nice addition to the string algorithm lib. -- Olaf
On Wed, Feb 18, 2015 at 2:57 PM, Olaf van der Spek
Hi,
Does Boost have functions like htmlspecialchars and urlencode (from PHP)? If not, I think they'd make a nice addition to the string algorithm lib.
There is XML character decorator in Boost.Log. It is based on a common tool called pattern_replacer which can be used as a function (see https://github.com/boostorg/log/blob/master/include/boost/log/expressions/fo...). In Boost.StringAlgo there are a number of replace algorithms which can be used for this.
On Wed, Feb 18, 2015 at 1:32 PM, Andrey Semashev
On Wed, Feb 18, 2015 at 2:57 PM, Olaf van der Spek
wrote: Hi,
Does Boost have functions like htmlspecialchars and urlencode (from PHP)? If not, I think they'd make a nice addition to the string algorithm lib.
There is XML character decorator in Boost.Log. It is based on a common tool called pattern_replacer which can be used as a function (see https://github.com/boostorg/log/blob/master/include/boost/log/expressions/fo...).
Does it do multiple passes over the input and update the string in-place? Doesn't look like a good idea.
In Boost.StringAlgo there are a number of replace algorithms which can be used for this.
Which one would be best? -- Olaf
On Fri, Apr 3, 2015 at 9:06 AM, Olaf van der Spek
On Wed, Feb 18, 2015 at 1:32 PM, Andrey Semashev
wrote: On Wed, Feb 18, 2015 at 2:57 PM, Olaf van der Spek
wrote: Hi,
Does Boost have functions like htmlspecialchars and urlencode (from PHP)? If not, I think they'd make a nice addition to the string algorithm lib.
There is XML character decorator in Boost.Log. It is based on a common tool called pattern_replacer which can be used as a function (see https://github.com/boostorg/log/blob/master/include/boost/log/expressions/fo...).
Does it do multiple passes over the input and update the string in-place? Doesn't look like a good idea.
In Boost.StringAlgo there are a number of replace algorithms which can be used for this.
Which one would be best?
Somebody? -- Olaf
On 18/02/2015 12:57, Olaf van der Spek wrote:
Hi,
Does Boost have functions like htmlspecialchars and urlencode (from PHP)? If not, I think they'd make a nice addition to the string algorithm lib.
htmlspecialchars is just replacing < with <, > with > and & with & (optionally " with " and ' with ' as well). It's a trivial application of the replace algorithm to the world of HTML and XML. I'm not sure the string algorithm lib is the right place for it, maybe an XML lib would be better.
On Wed, Feb 18, 2015 at 1:44 PM, Mathias Gaunard
On 18/02/2015 12:57, Olaf van der Spek wrote:
Hi,
Does Boost have functions like htmlspecialchars and urlencode (from PHP)? If not, I think they'd make a nice addition to the string algorithm lib.
htmlspecialchars is just replacing < with <, > with > and & with & (optionally " with " and ' with ' as well).
It's a trivial application of the replace algorithm to the world of HTML and XML. I'm not sure the string algorithm lib is the right place for it, maybe an XML lib would be better.
Does Boost have a XML lib? I don't really mind in what lib such a function would be created. -- Olaf
On 02/20/2015 08:25 AM, Olaf van der Spek wrote:
On Wed, Feb 18, 2015 at 1:44 PM, Mathias Gaunard
wrote:
htmlspecialchars is just replacing < with <, > with > and & with & (optionally " with " and ' with ' as well).
This does not take DTDs into account.
It's a trivial application of the replace algorithm to the world of HTML and XML. I'm not sure the string algorithm lib is the right place for it, maybe an XML lib would be better.
Does Boost have a XML lib?
No (I do not count the XML parser in Boost.PropertyTree as an XML lib.) There was a Boost.XML project at GSoC last year about creating C++ wrappers for other XML libraries, such as libxml2, but I do not know its current status.
participants (4)
-
Andrey Semashev
-
Bjorn Reese
-
Mathias Gaunard
-
Olaf van der Spek