UTF16 conversion

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

UTF16 conversion

Martin Kuball
Hi!

I have a ByteArray with 2-byte characters in it. Now I want to convert
it into a WideString. How can I do this?

My first idea to use

        byteArray asString convertToWithConverter: UTF16TextConverter new

gives a String object (wrong class?) with double the size of the
original ByteArray instead of half the size. So, what's the right
way?

Martin

Reply | Threaded
Open this post in threaded view
|

Re: UTF16 conversion

Yoshiki Ohshima
  Martin,

> My first idea to use
>
> byteArray asString convertToWithConverter: UTF16TextConverter
> new

  How about:

        byteArray asString convertFromWithConverter: UTF16TextConverter new

?

  To and from means that convert 'to' the outside world, and convert
'from' the outside world.  Isn't it obvious?^^;

-- Yoshiki