title: UTF-8 String Iterators
body: <p>I am trying to write a Unicode-supported cross-platform application. I am using the library UTF8-C++ ( <a href="http://utfcpp.sourceforge.net/">http://utfcpp.sourceforge.net/</a> ) but I am having trouble iterating through a string:</p>
  
  <pre><code>string s1 = "Добрый день";
  utf8::iterator&lt;string::iterator&gt; iter(s1.begin(), s1.begin(), s1.end());
  
  for(int i = 0; i &lt; utf8::distance(s1.begin(), s1.end()); i++, ++iter)
  {
      cout &lt;&lt; (*iter);
  }
  </code></pre>
  
  <p>The above code, when redirected to a UTF-8 formatted text file, produces the following output:</p>
  
  <pre><code>6 3 6 3 6 3 6 3 6 3 6 3 3 2 6 3 6 3 6 3 6 3 
  </code></pre>
  
  <p>How can I get the content of <code>s1</code> to appear in the file properly?</p>