UTF-16 iterators #
UTF16.decodeIter reads characters from UTF-16 code units, and UTF16.encodeIter writes them
back. An unpaired surrogate is ill-formed. A high surrogate reads its low surrogate by looking
ahead; when there is none, only the high surrogate is ill-formed, and lossy decoding goes on from
the next code unit.
The UTF-16 encoding form, as a decoder from code units and an encoder to code units.
Instances For
Equations
Decodes one character from the UTF-16 code units of it. Calls yield with the character and the
iterator after it, error with the iterator after an unpaired surrogate, or done at the end of
the input.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Decodes the UTF-16 code units of it, stopping at the first unpaired surrogate.
A for loop or fold over the result ends at ill-formed input just as at the end of the input. To
tell them apart, fold with decodeFold, which also returns the iterator where decoding stopped, and
check decodeError? there, find the first ill-formed input ahead with decodeFailure?, or decode
with decodeIterLossy instead.
Equations
Instances For
Decodes the UTF-16 code units of it, replacing each unpaired surrogate with U+FFFD.
Equations
Instances For
Encodes the characters of it as UTF-16 code units.