title: C# System.IO.Directory.CreateDirectory - create directory with utf-8 characters?
body: <p>I read data from utf-8 encoded file. Part of content of this file is then used as a name for newly created folder. However, my folder name is:</p>
  
  <p>bohou�_120328 instead of bohouš_120328</p>
  
  <p>How can I set proper coding for the name of newly created folder? Thanks.</p>
  
  <p><strong>edit:</strong></p>
  
  <p>I am reading information from file this way:</p>
  
  <pre><code>System.IO.StreamReader file = new System.IO.StreamReader(nameOfFile);
  
   while ((j = file.ReadLine()) != null) { 
      //manipulating string in j
   }
  </code></pre>
  
  <p>then creating directory with </p>
  
  <pre><code>if (Directory.Exists(folder) == false) {
                                      Console.WriteLine("creating directory " + folder);
                                      System.IO.Directory.CreateDirectory(@folder);
                                  } 
  </code></pre>
  
  <p>If I run my application on my Windows 7, 64bit computer, everything is fine. However, if I run in on other computers with older systems like WinXP, coding is just wrong and looks like this</p>
  
  <pre><code>bohou�_120328
  </code></pre>
  
  <p>Before using variable to creating folder, I write i to output, but everything is fine. Even folder names are fine. But just on my computer, unfortunately.</p>
  
  <p><strong>edit2</strong>:</p>
  
  <p>Things are getting even more weird. I used this code <a href="https://stackoverflow.com/questions/249087/how-do-i-remove-diacritics-accents-from-a-string-in-net">How do I remove diacritics (accents) from a string in .NET?</a> to remove diacritics, because names without diacritics are just fine for me.</p>
  
  <p>However, again:</p>
  
  <ol>
  <li>running code on my computer yields into bohous_120328</li>
  <li>running code on other computers AND my flash disk yields into bohou�_120328</li>
  </ol>
  
  <p>I swear it is the same code, as I COPIED my .exe file.</p>
  
  <p>Debugger says that the problem is already in my string variable before creating folder. I do not understand, how the environment influences my variables in this case.</p>
  
  <p>Will be happy for explanation :-)</p>