title: Make user input safe for XML
body: <p>What is the best practice for generating valid XML with PHP from user submitted text, e.g. eCommerce sales data with ampersands, angle brackets, non-ascii accent characters, new lines etc etc.</p>
  
  <p>What functions, libraries, regexes do folks rely on?</p>