title: c++ can't convert string to wstring
body: <p>I would like to convert a string variable to wstring due to some german characters that cause problem when doing a substr over the variable. The start position is falsified when any these special characters is present before it. (For instance: for "ä" size() returns 2 instead of 1) </p>
  
  <p>I know that the following conversion works:</p>
  
  <pre><code>wstring ws = L"ä";
  </code></pre>
  
  <p>Since, I am trying to convert a variable, I would like to know if there is an alternative way for it such as </p>
  
  <pre><code>wstring wstr = L"%s"+str //this is syntaxically wrong, but wanted sth alike
  </code></pre>
  
  <p>Beside that, I have already tried the following <a href="https://stackoverflow.com/questions/25116276/substr-with-characters-instead-of-bytes">example</a> to convert string to wstring:</p>
  
  <pre><code>string foo("ä"); 
  wstring_convert&lt;codecvt_utf8&lt;wchar_t&gt;&gt; converter;
  wstring wfoo = converter.from_bytes(foo.data());
  cout &lt;&lt; foo.size() &lt;&lt; endl;
  cout &lt;&lt; wfoo.size() &lt;&lt; endl;
  </code></pre>
  
  <p>, but I get errors like </p>
  
  <pre><code>‘wstring_convert’ was not declared in this scope
  </code></pre>
  
  <p>I am using ubuntu 14.04 and my main.cpp is compiled with cmake. Thanks for your help!</p>