Well, a "big hammer approach" might just call GetShortPathName on every filename, just to be sure... But that's a costly API call if your having to do this a million times a second.
So, long story short, I wrote this little function to detect unicode in a c# .Net string:
public static bool IsUnicode(string s)
{
return s != Marshal.PtrToStringAnsi(Marshal.StringToHGlobalAnsi(s));
}
Now homework for all you kiddies out there... Is this code a memory leak? If so, what should you do to fix it? If not, why not?