[squeak-dev] how to create an UTF-8 character

Norbert Hartl norbert at hartl.name
Tue Sep 23 09:50:13 UTC 2008


On Tue, 2008-09-23 at 10:46 +0200, stephane ducasse wrote:
> Hi all
> 
> I would like to know how I can create an UTF-* character composed for  
> example of two bytes
> 
> 16rC3 and 16rBC
> 
> I tried
> 
> 	WideString fromByteArray: { 16rC3 . 16rBC }
> 
> Stef
> 

Hmm, I'm not sure what you mean by UTF-* Character but this
way it works

(
  (
    String fromByteArray: (
      ByteArray with: 16rC3 with: 16rBC
    )
  ) convertFromEncoding: #utf8
) at: 1

And it is not a two-byte character because it is a character
that is contained in latin-1.

I thought there would be an easier/better way to do! Bert? :)

Norbert




More information about the Squeak-dev mailing list