title: Read unicode file with special characters using std::wifstream
body: <p>In a Linux environment, I have a piece of code for reading unicode files, similar as shown below.</p>
  
  <p>However, special characters (like danish letters æ, ø and å) are not handled correctly. For the line 'abcæøåabc' then output is simply 'abc'. Using a debugger I can see that the contents of <code>wline</code> is also only <code>a\000b\000c\000</code>. </p>
  
  <pre><code>#include &lt;fstream&gt;
  #include &lt;string&gt;
  
  std::wifstream wif("myfile.txt");
  if (wif.is_open())
  {
      //set proper position compared to byteorder
      wif.seekg(2, std::ios::beg);
      std::wstring wline;
  
      while (wif.good())
      {
          std::getline(wif, wline);
          if (!wif.eof())
          {
              std::wstring convert;
              for (auto c : wline)
              {
                  if (c != '\0')
                  convert += c;
              }
          }
      }
  }
  wif.close();
  </code></pre>
  
  <p>Can anyone tell me how I get it to read the whole line?</p>
  
  <p>Thanks and regards</p>