title: Not able to get some utf-8 characters printed correctly in C++ to txt file
body: <p>I have some UTF-8 strings in memory (this is part of a bigger system) which are basically name of places in European countries. What I'm trying to do is write them to a text file. I'm on my Linux machine (Fedora). So when I write these name strings (char pointers) to file, the file is getting saved in extended ASCII format.</p>
  
  <p>Now I copy this file to my Windows machine where I need to load these names to mySQL DB. When I open the text file on notepad++, again it defaults the encoding to ANSI. But I can select encoding to UTF-8 and almost all the characters looks as expected except the following 3 characters:- Ő, ő and ű. They are displayed within the text as &amp;#336, &amp;#337 and &amp;#369.</p>
  
  <p>Does anyone has any thought on what might be wrong. I know that these are not part of extended ASCII symbols. But the way I'm writing this to the file is something like:</p>
  
  <pre><code>// create out file stream
  std::ofstream fs("sample.txt");
  
  // loop through utf-8 formatted string list
  if(fs.is_open()) {
      for(int i = 0; i &lt; num_strs; i++) {
          fs &lt;&lt; str_name; // unsigned char pointer representing name in utf-8 format
          fs &lt;&lt; "\n";
      }
  }
  fs.close();
  </code></pre>
  
  <p>Everything looks good even with characters like ú and ö and ß. The issue is with the above 3 characters alone. Any thoughts/suggestions/comments on this? Thanks!</p>
  
  <p>As an example, a string like "Gyömrő" shows up as "Gyömr&amp;#369".</p>