[squeak-dev] String >> utf8Encoded, ByteArray >> utf8Decoded

Tony Garnock-Jones tonyg at leastfixedpoint.com
Sun Jan 28 15:16:10 UTC 2018


Pharo has these two convenience methods:

    String >> utf8Encoded
    ByteArray >> utf8Decoded

It looks like, roughly,

 - Pharo's  "aString utf8Encoded" is equivalent to
   Squeak's "aString squeakToUtf8 asByteArray", and

 - Pharo's  "aByteArray utf8Decoded" is equivalent to
   Squeak's "aByteArray asString utf8ToSqueak".

Should we add definitions like the following to Squeak?

    String >> utf8Encoded
      ^ self squeakToUtf8 asByteArray

    ByteArray >> utf8Decoded
      ^ self asString utf8ToSqueak

?

It takes me an age to find the proper Squeakly incantation every time I
work with network protocols in Squeak. I think these convenience methods
would help.

Tony


More information about the Squeak-dev mailing list