title: Basic issue regarding full unicode in C++
body: <p>What are the proper facilities to be using for full unicode in C++?</p>
  
  <p>For example, I have tried:</p>
  
  <pre><code>int main()                                                                                                                                                                 
  {                                                                                                                                                                          
      std::wstring name;                                                                                                                                                 
      std::wcout &lt;&lt; "Enter unicode: " &lt;&lt; std::endl;                                                                                                                
      std::getline(std::wcin, name);                                                                                                                                     
  
      std::wcout &lt;&lt; name &lt;&lt; std::endl;                                                                                                                                   
  
      return 0;                                                                                                                                                              
  }  
  </code></pre>
  
  <p>And it doesn't work as I would expect when entering the character:  or others that are not in the Unicode BMP. I get an empty line printed out.</p>
  
  <p>Plain string works for any code points up to 16bits, wstring, wcin, wcout just don't work as I'd expect and some Googling hasn't helped me see what about this could be wrong.</p>
  
  <p>EDIT (file I/O also has issues!):</p>
  
  <p>I wondered if this could have something do with with the console I/O itself and wanted to try the same for file I/O as an experiment. I looked into the api's and came up with this which compiles and runs fine:</p>
  
  <pre><code>int main()                                                                                                                                                                 
  {                                                                                                                                                                          
      std::string filename;                                                                                                                                                  
      std::cout &lt;&lt; "Enter file to append to: " &lt;&lt; std::endl;                                                                                                                 
      std::getline(std::cin, filename);                                                                                                                                      
  
      std::wifstream file;                                                                                                                                                   
      std::wstringstream buff;                                                                                                                                               
      file.open(filename);                                                                                                                                                   
      std::wstring txt;                                                                                                                                                      
      buff &lt;&lt; file.rdbuf();                                                                                                                                                  
      file.close();                                                                                                                                                          
      txt = buff.str();                                                                                                                                                      
  
      std::wcout &lt;&lt; txt &lt;&lt; std::endl;                                                                                                                                        
  
      return 0;                                                                                                                                                              
  }                                                                                                                                                                          
  </code></pre>
  
  <p>But when I point it to my file with mostly lorem ipsum and a few non-BMP characters, it prints the file up to the first non-BMP character and then stops early. Can the Unicode facilities in modern C++ really be this bad?</p>
  
  <p>I'm sure someone knows something basic I am missing here...</p>