title: Getting substring without messing up UTF-8 string
body: <p>I have a UTF-8 encoded string that comes from an ajax response, I want to get substring of that string up to the first comma. For the string <code>"Привет, мир"</code> it would be <code>"Привет"</code>.</p>
  
  <p>Will this work and not run into "multibyte-ness" issues?</p>
  
  <pre><code>var i = text.indexOf(',');
  if (i != -1) text = text.substr(0, i);
  </code></pre>
  
  <p>Or is it better to use <code>split</code>?</p>