title: How can I tell if a string contains multibyte characters in Javascript?
body: <p>Is it possible in Javascript to detect if a string contains multibyte characters? If so, is it possible to tell which ones?</p>
  
  <p>The problem I'm running into is this (apologies if the Unicode char doesn't show up right for you)</p>
  
  <pre><code>s = "";
  
  alert(s.length);    // '2'
  alert(s.charAt(0)); // '��'
  alert(s.charAt(1)); // '��'
  </code></pre>
  
  <hr>
  
  <p><strong>Edit for a bit of clarity here <em>(I hope)</em>.</strong> <em>As I understand it now</em>, all strings in Javascript are represented as a series of UTF-16 code points, which means that regular characters actually take up 2 bytes (16 bits), so my usage of "multibyte" in the title was a bit off. Some characters do not fall in the Basic Multilingual Plane (BMP), such as the string in the example above, and so they take up two code points (32 bits). That is the question I was asking. I'm also not editing the original title, since to someone who doesn't know much about this stuff (and hence would be searching SO for info about it), "multibyte" would make sense.</p>