I have a VB6 application that does a directory listing of a folder and picks up the filenames. Some of these are accented, for example "Guimarães.txt" (small A with a tilde). Both the VB Dir function, and FileSystemObject functions are unable to recognise the accented character, and instead return the filename as "Guimar?es.pdf", so I am subsequently unable to open the file. I can see the file correctly in Windows Explorer
This is only happening in one live environment, running Windows Server 2003 R2. On our test systems, we can read the file correctly, though these are mainly Windows 2008 and Windows 7. I initially thought it was down to the version of FSO, but as "Dir" gives the same results, I no longer think so. Also, when I write the name of the file to a log file, it is also incorrect. So I think that at a very early stage it is unable to handle the character, and replaces it with a question mark.
What I need to establish is the cause of the issue: is it down to the version of Windows, or my regional settings (which I am unable to view, as my account is locked down), and what can I do to resolve the problem. For now, I've asked the users not to use these characters, but this is not a long-term solution.
Thanks.
Ok, the file name being read off disk uses unicode. When you try and display this, the font in use doesn't support that glyph so it shows the "?", but writing it to disk writes the correct representation. When this is then passed to the file functions, it's "converted" to MBCS or another charset which then breask.
You can either change your code to use the native wide Win32 API calls, or just change the "langauge for non unicode programs" to match the language used in the filename.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With