From: "Berger, Daniel" Date: 2005-03-10T02:25:45+09:00 Subject: Re: Win32 Non-ASCII Filename Access > -----Original Message----- > From: Austin Ziegler [mailto:halostatue@gmail.com] > > IF the UNICODE macro is set. Basically, most Windows functions look > > like this: > > I know. > > UNFORTUNATELY, to get that to work, you also have to use > TCHAR as your character type. That is, instead of: > > char* spec = "C:\\Foo\\Bar\\*.*"; > > you need: > > TCHAR* spec = "C:\\Foo\\Bar\\*.*"; > > This may cause *other* problems with Ruby, since it seemss to > be written around the assumption that a character is a single > byte wide. That isn't my understanding, though perhaps I'm not "getting it". From what I've read, TCHAR is 2 bytes wide if UNICODE is defined. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/un icode_28c3.asp Or is the problem in the Ruby handling of TCHAR's and not TCHAR itself? > Ultimately, the only acceptable way to do this is to NOT use > TCHAR, but to explicitly use the wide versions of functions > and do MultibyteToWide and WideToMultibyte calls as > necessary. The best choice for this will be, of course, UTF-8 > (CP_UTF8), but if we're not in UTF-8 mode, we can always use > ANSI (CP_ACP) and get the exact same behaviour. Better, we > get to choose the mode of behaviour at run-time. Ugh. I really hope this isn't necessary. > I do NOT recommend the use of TCHAR and _TEXT; they are > Microsoftisms, and they won't be compatible with standard > Ruby, I don't think. I definitely think we should test this. Any suggestions how? Regards, Dan