Here's the deal, as far as I defined: at least with Windows 8.1, “Explorer.exe” seems to highlight all character combinations before searching for the file. You can check this either in C # or in the console (first chcp 65001 to switch to Unicode mode). If you try to open a target named ปู (Thai for "crab"), this will not work, but if you remove the vowel, so that you only have , it will work. In addition, if you have a folder named ป and you, as you open ปู, open the folder ป!
This explains why some other developers have no problems; the problem is not ascii : rather, these are file names with compound characters. Not all languages use them, and even in the languages that do this, not all file names have them.
The good news is that there is another way to open them that do not have this problem, which is described by @ bert-huijben in this answer .
For completeness, here is a version similar to what I ended up using:
[DllImport("shell32.dll", ExactSpelling = true)] public static extern void ILFree(IntPtr pidlList); [DllImport("shell32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)] public static extern IntPtr ILCreateFromPathW(string pszPath); [DllImport("shell32.dll", ExactSpelling = true)] public static extern int SHOpenFolderAndSelectItems(IntPtr pidlList, uint cild, IntPtr children, uint dwFlags); public void SelectItemInExplorer(string path) { var pidlList = ILCreateFromPathW(path); if(pidlList == IntPtr.Zero) throw new Exception(string.Format("ILCreateFromPathW({0}) failed",path)); try { Marshal.ThrowExceptionForHR(SHOpenFolderAndSelectItems(pidlList, 0, IntPtr.Zero, 0)); } finally { ILFree(pidlList); } }
source share