title: ASCII Value of blank character in file name
body: <p>I have many Windows 7 data file names that appears to contain a blank space just before the extension.  Ultimately, I want to eliminate the blank spaces, but my immediate problem is finding them.  I assumed converting each character of the file name to an ASCII value and then using IndexOf the ASCII value would find my "space".  However that isn't working.</p>
  
  <pre><code>        string name = Path.GetFileName(fileName);
          Console.WriteLine(name);
          byte[] ASCIIValues = Encoding.ASCII.GetBytes(name);
          foreach(byte b in ASCIIValues)
              Console.WriteLine(b);
          if(name.IndexOf((char)63) != -1)
              Console.WriteLine("Space");
              else
              Console.WriteLine("NO Space");
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>XL .WL
  88
  76
  63
  46
  87
  76
  NO Space
  </code></pre>
  
  <p>Since the "space" is being reported as ASCII decimal 63, I would have expected the if to write "Space", not the else to write "NO Space".  Substituting any of the other reported ASCII values in the if, gives "Space" as the final output.</p>
  
  <p>Any ideas what I'm doing wrong or other ways to find the file names with the extra "space"?</p>