Discussion:
Russian characters in file names
(too old to reply)
Frank
2012-11-12 16:25:10 UTC
Permalink
Dear people,

I have the following problem.
When I create files on a computer with a Russian Windows,
with Russian file names, and transfer them to a
computer with English Windows, the file explorer
of Windows shows the file names correctly in Cyrillic.
But if I parse the directory where they are
situated with an MFC program, I get just question
marks as the file names. The goal is to open
and read the files. How does the Explorer do that,
and is it possible in MFC, too?
ScottMcP [MVP]
2012-11-12 16:57:02 UTC
Permalink
Dear people, I have the following problem. When I create files on a computer with a Russian Windows, with Russian file names, and transfer them to a computer with English Windows, the file explorer of Windows shows the file names correctly in Cyrillic. But if I parse the directory where they are situated with an MFC program, I get just question marks as the file names. The goal is to open and read the files. How does the Explorer do that, and is it possible in MFC, too?
The details of this vary with which version of VC++ you are using. You need to change your project "Character Set" property to "Use Unicode Character Set". Then you will find that char and std::string variables cause problems, and will have to be changed to wchar_t and std::wstring. In other words, all your character storage needs to change to 16 bit wide characters.
David Lowndes
2012-11-12 17:00:08 UTC
Permalink
Post by Frank
But if I parse the directory where they are
situated with an MFC program, I get just question
marks as the file names.
This typically happens if your application isn't built for UNICODE
since characters not contained in the code page get converted to '?'.

Change your project settings to Unicode (rather than ANSI/MBCS), fix
any places in your code that assume ANSI characters (if you've not
wildly applied casts the compiler should give errors and you can then
fix them), and that should fix your problem.

Dave

Continue reading on narkive:
Loading...