Filenames with Win32 special characters (or: Interix filename compatibility)

Corinna Vinschen
Wed Mar 12 14:35:00 GMT 2008

On Mar 11 19:27, Corinna Vinschen wrote:
> On Mar 11 09:55, Brian Dessent wrote:
> > But going through the entire list of combining characters, I
> > did find one with an interesting property: U+0331: COMBINING MACRON
> > BELOW.  When displayed in Explorer, it looks like the normal letter with
> > a small underline.  But the neat property of this character is that when
> > converted from Unicode to cp1252 it converts to the underscore, meaning
> > stupid ANSI programs can still edit/open/save these files.  So we'd
> > encode uppercase ascii as simply 'A' -> "A\x0331", 'B' -> "B\x0331" and
> > so on.  It doesn't have the property of the same length, but they still
> > remain intelligible in dumb apps.
> > 
> > (BTW, for a real hoot try creating a filename containing U+034F
> This approach sounds quite interesting!

Did I miss something?  I created a file with a special filename like this:

  #include <windows.h>

  main ()
    WCHAR fname[] = { L'C', L'F', L'W', 0x0331,
		      L'C', L'F', L'W', 0x034f, L'\0' };
    CreateFileW (fname, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
    return 0;

I don't see that this filename is printed correctly according to the
meaning of these characters in Explorer on Windows XP.
Rather, it looks like all filenames with strange chars:


The hash character acting as this box char printed for unknown character
values.  If I switch the font, I can get a trailing underscore for the
0x0331 character.  I didn't find a font which shows this correctly as
half width underscore under the preceding character.  No font printed
the 0x034f character other than as a box.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-developers mailing list