phobos/tango on win32: please drop ANSI "support"
Walter Bright
newshound at digitalmars.com
Thu Feb 15 08:21:52 PST 2007
Lionello Lunesu wrote:
> Walter Bright wrote:
>> It does convert to the correct code-page. See
>> std.windows.charset.toMBSz().
> The problem is that this function is not always called. And because, by
> default, the A-functions are the ones that get aliased to the 'normal
> form', many times the utf8 char[] is passed as if it were 'ansi'.
>
> A quick grep reveals:
>
> std\loader.d [5]
> std\windows\registry.d [35]
Those would be bugs. All the ones using useWfuncs are correctly done
(see std.file).
>> 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'.)
>
> Yes, but it would be done by Windows. Instead of:
>
> if (UseWFuncs)
> WhatEverA( str.toMBSz );
> else
> WhatEverW( str.toUTF16z );
>
> You'd do only:
>
> WhatEverW( str.toUTF16z );
>
> and Windows' unicode layer for Win9x would convert the string back to
> the proper code-page. Hey, which is exactly what's going on in
> std.windows.charset! But at least I don't have to worry about
> "UseWFuncs" in my own code anymore...
unicode layer for Windows is not part of Win9x, it's a separate add-on.
This means that in order to use a D executable, the user would have to
find and install MSLU. This is unacceptable - I don't want to deal with
the constant "bug reports" about this.
>>> that also happens to be efficient for Windows 2000 and up.
>>
>> Under Windows NT, 2000, and up, the 'W' functions *are* called.
>
> Only is you'd bother to check UseWFuncs. You probably would, but many
> don't.
>
>>> 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.
>
> You could provide link-time support only, using version blocks?
Then there'd be two Phobos libraries, and the D programmer would have to
ship two different executables. This is not worth it.
More information about the Digitalmars-d
mailing list