Non-ASCII String Character Index in C++
<p>I'm working on a small C++ app that does a bit of string handling. Currently, I want to get extract a string at a particular character index. My naive solution of using string's at() method works fine, but it breaks for non-ascii strings. For example:</p>

<pre><code>string test = "ヘ(^_^ヘ)(ノ^_^)ノ"
cout &lt;&lt; test.at(0) &lt;&lt; endl;
</code></pre>

<p>Produces a pound sign as output for me under gcc 4.2. I don't think it's a problem with my terminal either, because I can print out the entire string just fine. Is there a library or something I could use to get the desired effect?</p>
