FFI wide-character type?
Ron at USMedRec.com
Fri Aug 4 13:48:18 UTC 2006
Thanks for looking some more. I had tried asWideString and received back a
wideString class, but was confused by the bytes on the inspector. Since the
bytes were the same as a regular string I figured it was doing something
wrong, like the other things I'd tried.
So now that I understand that asByteArray forms bytes differently then what
is in the instance inspector, I thought I'd try it.
What I get is 'MY' asWideString asByteArray = a ByteArray(0 0 0 77 0 0 0 89)
Trying that didn't work.
I received a message from Torsten (Thank you!) that said he had a conversion
to wide string for COM. I tried that method to see what it returned.
COMWideString fromString: 'MY' = a ByteArray(77 0 89 0). I tried sending in
the byteArray and BINGO! It worked.
So the question is, are there multiple ways to do conversion to wide string,
or is asWideString asByteArray doing it wrong? Maybe there are ordering and
byte count multiplatform things to consider? (I'm on winXP, if it wasn't
> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org [mailto:squeak-dev-
> bounces at lists.squeakfoundation.org] On Behalf Of John M McIntosh
> Sent: Friday, August 04, 2006 3:23 AM
> To: The general-purpose Squeak developers list
> Subject: Re: FFI wide-character type?
> Oh sure after I spend an hour typing out a note about this.
> 'abc' asWideString asByteArray
> will do the right thing assuming your 'abc' String doesn't need
> conversion, even so
> ('abcd' convertFromWithConverter: (MacRomanUnicodeTextConverter new))
> asWideString asByteArray
> will also do the right thing, although it's a bit more expensive as
> it rummages about deciding if the intermediate parts are String or
> On 3-Aug-06, at 7:21 PM, Ron Teitelbaum wrote:
> > I found a solution that allows me to use ascii characters.
> John M. McIntosh <johnmci at smalltalkconsulting.com>
> Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
More information about the Squeak-dev