Utf16
Description
Container class containing UTF-16 platform-endian encoding.
@see Class Comments in <EsUnicodeEncoding> for usage examples.
Class Methods
None
Instance Methods
asUnicodeString:
  Answer a new unicode string instance from the receiver.

     Examples:
     'Grinning Face (U+1F600) in platform endian'.
     self assert: [
         (System bigEndian
            ifTrue: [(Utf16 with: 16r3DD8 with: 16r00DE) asUnicodeString]
            ifFalse: [(Utf16 with: 16rD83D with: 16rDE00) asUnicodeString]) first name = 'GRINNING FACE'].

      'Invalid because of isolated surrogate - 16rD800'.
      self assert: [((Utf16LE with: 16rD800) asUnicodeString: true) = UnicodeScalar replacementCharacter asUnicodeString].

     Answers:
        <UnicodeString>
isValid
  Answer true if the content of the container represents valid UTF-16 data
     encoded in the endian type defined by the container.

     Examples:
        'Grinning Face (U+1F600) in platform endian'.
        self assert: [
            System bigEndian
                ifTrue: [(Utf16 with: 16r3DD8 with: 16r00DE) isValid]
                ifFalse: [(Utf16 with: 16rD83D with: 16rDE00) isValid]].

        'Invalid because of isolated surrogate - 16rD800'.
        self assert: [(Utf16LE with: 16rD83D with: 16rD800) isValid not]

     Answers:
        <Boolean> true if valid, false if invalid
Last modified date: 04/20/2022