--- In [email protected], "mockey_a" <[EMAIL PROTECTED]> wrote:
> > iwNum=dll.call("MultiByteToWideChar|ui ui s i x i",;;+
> > 0,0,"sString",-1,"xString",0)
>
> Is 0 the current charset (first parameter)? Doh. I tried getting it
> with GetACP...
0 is sort of a switch to make using "the current system Windows ANSI
code page", which is the one you'll get via GetACP, I think.
Another notice: I also set the second parameter simply to 0, but you
may have to use 1 instead to make 100% sure, which has never been
necessary in my case.
> x is for a byteblock, right? Is this appropriate for a LPWSTR?
> Is it not necessary to define the return value (another int at the
> end)?
Actually this is needed to get the size of the will-be-returned
unicode string, so "xString" doesn't play a role here. You can simply
use the following instead:
iwNum=dll.call("MultiByteToWideChar|ui ui s i ui i",;;+
0,0,"sString",-1,0,0)
> > xString=repeat(" ",iwNum*2) ;; needed when sString is long
>
> Ah, this is how to initialize the byteblock? Good to know.
> But is this really wide enough for real wide chars? Don't know... I
> think a unicode-char can have up to 4 bytes if I'm not mistaken...
I think you mean the surrogate pair in UTF-16, right? I suppose it
would be counted as 2 wide characters, not simply as 1 wide character,
so *2 would be enough. However, I'm not 100% sure about this.
Actually there is a 6-byte overhead in ByteBlock which I simply
ignored here. If it would still crash PP, you may have to use
iwNum*2+6 instead (:iwNum*2+5 may be enough, to be precise).
BTW, I think Alan already implemented a mechanism to appropriately
resize/allocate the needed memory blocks, but it doesn't work somehow
as expected (:I also tried, x1000 for example, however didn't work
either).
> > iuNum=dll.call("WideCharToMultiByte|ui ui x i s i ui ui",;;+
> > 65001,0,"xString",-1,"uString",0,0,0)
>
> Damn, I overlooked that function. Went all the way from hex to
> binary and via a conversion-table back to hex. Not nice...
Sean
Attention: PowerPro's Web site has moved: http://www.ppro.org
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/power-pro/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/