Utf32
Description
Container class containing UTF-32 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.
   If @repair is true, then invalid utf32 will be replaced with the unicode replacement character U+FFFD.
   
   Examples:
    'Grinning Face (U+1F600)'.
    self assert: [(Utf32LE with: 16r1F600) asUnicodeString first name = 'GRINNING FACE'].
    
    'Invalid UTF32-encoding'.
    self assert: [[(Utf32LE with: 16rD800) asUnicodeString. false] on: Exception do: [:ex | ex exitWith: true]].
    
    'Repaired invalid UTF8-encoding'.
    self assert: [((Utf32LE with: 16rD800) asUnicodeString: true) = UnicodeScalar replacementCharacter asUnicodeString].

   Arguments:
    repair - <Boolean>
   Answers:
    <UnicodeString>
isValid
   Answer true if the content of the container represents valid UTF-32 data
   encoded in the endian type defined by the container.
   
   Examples:
    'Grinning Face (U+1F600) in platform endian'.
    self assert: [
      System bigEndian
        ifTrue: [(Utf32 with: 16r1F600) isValid]
        ifFalse: [(Utf32 with: 16r1F600) isValid]].
    
    'Invalid because of isolated surrogate - 16rD800'.
    self assert: [(Utf32LE with: 16r1F600 with: 16rD800) isValid not]
   
   Answers:
    <Boolean> true if valid, false if invalid
Last modified date: 01/18/2023