Strip UTF-8 characters invalid for use in XML markup

When you put UTF-8 encoded strings into an XML document you should remember that not all UTF-8 characters are accepted in an XML document http://www.w3.org/TR/REC-xml/#charsets

You should strip away the invalid characters, else you’ll have an XML fatal parsing error tossed during parsing.

It’s rather easy to accomplish this using the following function.

 

Author: Richard Soares

Director of Software Development & Senior Technical Project Manager