phobos/tango on win32: please drop ANSI "support"

Walter Bright newshound at digitalmars.com
Thu Feb 15 00:30:21 PST 2007


Lionello Lunesu wrote:
> Walter Bright wrote:
>> The "useWfuncs" only happens for Windows 9x (including Me). All 
>> Windows 9x systems are 8 bit internally, and even if you use the W 
>> interface, they are internally converted to 8 bits anyway.
> 
> Yes, they will be converted to "8 bits", but not to utf8. They will be 
> converted to whatever code-page the thread's currently using, which is 
> what's supposed to be done. That's my point: both Phobos and Tango pass 
> utf8 to ANSI (..A) versions of Windows' functions, which is not correct.
> 
> You should either convert the utf8 to the correct code-page for passing 
> to WhatEverA(..),

It does convert to the correct code-page. See std.windows.charset.toMBSz().

> or convert it to utf16 and pass it to WhatEverW(..). 
> The last one is much easier: a fixed, straightforward conversion (no 
> need to know about code-pages)

This just does not work under Win9x, because most of the 'W' functions 
are not supported. (Also, Win9x internally converts the few 'W' 
functions it does support right back to 'A'.)

> that also happens to be efficient for 
> Windows 2000 and up.

Under Windows NT, 2000, and up, the 'W' functions *are* called.

> As for UseWFuncs: I don't like it because the check is done at run-time.

It has to be done at runtime, because that's the only way to make it 
work between different Windows versions.

> It's allover the place, practically doubles all Win32 code, not to 
> mention the imports / obj-size. More importantly, for the reasons 
> mentioned above, I don't think it's necessary.

There's no hope for it unless all support for Win9x is dropped.



More information about the Digitalmars-d mailing list