April 24, 2008
Tango and almost all Tango based libs and tools have same issue:
use tango.stdc.stringz.toStringz(name) or name ~ '\0' instead of toMBSz(name) for calling A version Windows API, that's wrong!
program may crashed if multi byte name.

you might say, why not just create a ticket for Tango, right, I created it long time ago, but Kris seems not a MS fans :)
http://www.dsource.org/projects/tango/ticket/653

you might say, how about the tango.sys.win32.CodePage module?

but:
1 the name, "toMBSz" is better than "CodePage" in this case
2 the implementation, toMBSz is better in this case
2 Tango itself not use CodePage module in this case

It is too tedious to create bug tickets for every tango based libs, tools(if have this issue)!

I can't understand what's the problem if add toMBSz to tango.sys.win32, if problem, why Phobos have not this problem?



-- 
yidabu <yidabu.spam@gmail.com> http://www.dsource.org/projects/dwin

D 语言-中文(D Chinese): http://www.d-programming-language-china.org/ http://bbs.d-programming-language-china.org/ http://dwin.d-programming-language-china.org/ http://scite4d.d-programming-language-china.org/


April 24, 2008
yidabu wrote:

> 
> Tango and almost all Tango based libs and tools have same issue:
> use tango.stdc.stringz.toStringz(name) or name ~ '\0' instead of
> toMBSz(name) for calling A version Windows API, that's wrong! program may
> crashed if multi byte name.

You can't say wrong without coming with a solution, or at least an explanation why it is wrong.

> you might say, why not just create a ticket for Tango, right, I created it long time ago, but Kris seems not a MS fans :) http://www.dsource.org/projects/tango/ticket/653

This ticket is closed with no comments to its resolution - what is your point? This doesn't have much to do with fan-dom either, we're just mostly Unicode users.

> you might say, how about the tango.sys.win32.CodePage module?
> 
> but:
> 1 the name, "toMBSz" is better than "CodePage" in this case
> 2 the implementation, toMBSz is better in this case
> 2 Tango itself not use CodePage module in this case
> 
> It is too tedious to create bug tickets for every tango based libs,
> tools(if have this issue)!
> 
> I can't understand what's the problem if add toMBSz to tango.sys.win32, if problem, why Phobos have not this problem?

The problem is that you are not explaining the problem. You say there is a problem, but you don't provide us with test cases that fail, neither give proper resolutions. Bill did provide some clarifications in the previous round, and some of those issues has been resolved, but some were still not clear enough to figure out how they could be solved.

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango
April 24, 2008
On Thu, 24 Apr 2008 21:26:28 +0200
Lars Ivar Igesund <larsivar@igesund.net> wrote:

thanks for you reply.

> You can't say wrong without coming with a solution, or at least an explanation why it is wrong.

is it right? the solution is Phobos way: toMBSz(name)


>This doesn't have much to do with fan-dom either, we're just mostly
> Unicode users.

I'm Unicode user, not the D users, A version Windows API need multi byte convert.


> The problem is that you are not explaining the problem. You say there is a problem, but you don't provide us with test cases that fail, neither give proper resolutions. Bill did provide some clarifications in the previous round, and some of those issues has been resolved, but some were still not clear enough to figure out how they could be solved.

the problem is Tango has many bad(wrong?) sample for calling A vesion Windows API, and Tango based code have not a convenient way to calling A version Windows API.


-- 
yidabu <yidabu.spam@gmail.com> http://www.dsource.org/projects/dwin

D 语言-中文(D Chinese): http://www.d-programming-language-china.org/ http://bbs.d-programming-language-china.org/ http://dwin.d-programming-language-china.org/ http://scite4d.d-programming-language-china.org/


April 25, 2008
yidabu wrote:

> On Thu, 24 Apr 2008 21:26:28 +0200
> Lars Ivar Igesund <larsivar@igesund.net> wrote:
> 
> thanks for you reply.
> 
>> You can't say wrong without coming with a solution, or at least an explanation why it is wrong.
> 
> is it right? the solution is Phobos way: toMBSz(name)

This is not an answer to my statement, or at least I don't understand it as so.

>>This doesn't have much to do with fan-dom either, we're just mostly
>> Unicode users.
> 
> I'm Unicode user, not the D users, A version Windows API need multi byte convert.

If you create a program using Unicode, so does it's users, right? Or are you forwarding this from D users not using Unicode (and if so, why don't they use Unicode?)?

>> The problem is that you are not explaining the problem. You say there is a problem, but you don't provide us with test cases that fail, neither give proper resolutions. Bill did provide some clarifications in the previous round, and some of those issues has been resolved, but some were still not clear enough to figure out how they could be solved.
> 
> the problem is Tango has many bad(wrong?) sample for calling A vesion Windows API, and Tango based code have not a convenient way to calling A version Windows API.

Yes, so you say - but you don't point to which are problematic, and how they should be fixed (I assume you know, since you appear to know why they are wrong).

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango
April 25, 2008
Lars Ivar Igesund wrote:
[snip]

I think what Yibadu is saying (and you're misunderstanding) is that Tango calls the *A functions with UTF-8 text, while they expect text in whatever the current codepage is.
The way he proposes to fix this is by porting std.windows.charset.toMBSz from Phobos and using that to convert (or writing an equivalent function).

I haven't checked whether his claim is correct, but I'm pretty sure you didn't understand what he was saying. I hope I managed to express it more clearly.
April 25, 2008
On Fri, 25 Apr 2008 21:31:49 +0200
Frits van Bommel <fvbommel@REMwOVExCAPSs.nl> wrote:

> Lars Ivar Igesund wrote:
> [snip]
> 
> I think what Yibadu is saying (and you're misunderstanding) is that
> Tango calls the *A functions with UTF-8 text, while they expect text in
> whatever the current codepage is.
> The way he proposes to fix this is by porting std.windows.charset.toMBSz
> from Phobos and using that to convert (or writing an equivalent function).
> 
> I haven't checked whether his claim is correct, but I'm pretty sure you didn't understand what he was saying. I hope I managed to express it more clearly.

Thanks.

If you are the member of Tango team, my posts of this are not necessary, I think:)

-- 
yidabu <yidabu.spam@gmail.com> http://www.dsource.org/projects/dwin

D 语言-中文(D Chinese): http://www.d-programming-language-china.org/ http://bbs.d-programming-language-china.org/ http://dwin.d-programming-language-china.org/ http://scite4d.d-programming-language-china.org/


April 26, 2008
Frits van Bommel wrote:

> Lars Ivar Igesund wrote:
> [snip]
> 
> I think what Yibadu is saying (and you're misunderstanding) is that
> Tango calls the *A functions with UTF-8 text, while they expect text in
> whatever the current codepage is.
> The way he proposes to fix this is by porting std.windows.charset.toMBSz
> from Phobos and using that to convert (or writing an equivalent function).
> 
> I haven't checked whether his claim is correct, but I'm pretty sure you didn't understand what he was saying. I hope I managed to express it more clearly.

Okay, thanks, that makes sense. It says little about which calls these are though. Some (all?) has been fixed in SVN and/or noted in tickets - since this is brought up again I wondered if there were others.

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango
April 26, 2008
> It says little about which calls these are though.
For example in tango.io.FileConduit an utf8 string is passed to CreateFileA.
April 26, 2008
Frits van Bommel wrote:
> I think what Yibadu is saying (and you're misunderstanding) is that Tango calls the *A functions with UTF-8 text, while they expect text in whatever the current codepage is.
> The way he proposes to fix this is by porting std.windows.charset.toMBSz from Phobos and using that to convert (or writing an equivalent function).

All Windows API calls under Windows 9x should use the "A" api's whenever possible (instead of the "W" apis), and toMBSz should be called to convert unicode strings to "A" strings. Phobos does this.
April 27, 2008
yidabu wrote:

> 
> Tango and almost all Tango based libs and tools have same issue:
> use tango.stdc.stringz.toStringz(name) or name ~ '\0' instead of
> toMBSz(name) for calling A version Windows API, that's wrong! program may
> crashed if multi byte name.

Ok, now I have an understanding of what is said here - the way to have this fixed is (as always) to create a ticket, preferably with a patch tested by someone who needs to use *A functions of the Win API.

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango
Top | Discussion index | About this forum | D home