Htmlspecialchars and encoding

Skip to first unread message

Michael Clerx

May 27, 2011, 10:43:03 AM5/27/11
to simplewiki
For all sorts of encoding issues & preferences it'd be nice to be able
to change the way html text is emitted. I've currently hacked this
into the emitter by replacing all calls to htmlspecialchars($text)
with a call to $this->htmlChars($text). This method then calls
htmlspecialchars with slightly modified parameters (in fact, it even
calls htmlentities instead!)

A more versatile implementation could use a callback instead, and some
method like setHtmlspecialcharsCallback($callback)

Could a similar trick be implemented in the official version?

Henrik Bechmann

May 27, 2011, 2:13:38 PM5/27/11
Oh goody, more indirection!<grin>.

I don't see why not, and I'll put it on the list. Simplewiki can provide the default handler which can use htmlpecialchars.

I may do htmlChars($text, $node = NULL) to provide the callback the option to make decisions based on the type (or context) of node that is requesting the filter.

I may call it something else too, like charFilter perhaps.

- H

You received this message because you are subscribed to the Google Groups "simplewiki" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply all
Reply to author
0 new messages