title: Check if string is UTF-8 returning \u+hex if so, false if not
body: <p>For <a href="https://stackoverflow.com/a/22273848/1382306">XSS safety</a>, I'd like to convert all characters to \u+hex encoding.  I've seen <a href="https://stackoverflow.com/a/5786516/1382306">UTF-16 solutions</a>, but I can't find anything for UTF-8.</p>
  
  <p>I first want to ensure that all characters are UTF-8.  Here, I've seen many solutions but nothing consistent for javascript.</p>
  
  <p>How can a string be tested for UTF-8 and return the \u+hex encoding if so yet false if not?</p>