a question about utf-16 conversion

Yoshiki Ohshima yoshiki at squeakland.org
Wed Jun 15 12:37:36 UTC 2005


  John,

> foo := 'ackbar' convertToWithConverter: (TextConverter  
> newForEncoding: 'utf-16').
> 
> That works ok, I'll assume it is correct?

  I think so.

> But on the way back from the plugin I get a ByteArray of
> kTextEncodingUnicodeDefault  + kTextEncodingDefaultFormat  or  
> kUnicode16BitFormat which is what os-x 10.3 or lower provides.
> 
> So how do I convert that back to say a String, or a WideString?

  foo := aByteArray asString
            convertFromWithConverter: (TextConverter newForEncoding: 'utf-16').

should do something.

-- Yoshiki



More information about the Squeak-dev mailing list