Documentation

UnicodeFormat.UTF16

UTF-16 #

A code point below U+10000 is a single code unit. A code point from U+10000 to U+10FFFF is a surrogate pair: a high surrogate in D800–DBFF carrying the top ten bits of c - 0x10000, then a low surrogate in DC00–DFFF carrying the bottom ten bits. A surrogate that is not part of such a pair is ill-formed.

Decoding uses the decoder of UTF16.decodeIter. decode reports the position of the first unpaired surrogate, as an index in the slice.

The UTF-16 code units of c: one for a character of the BMP, two for a surrogate pair.

Equations
Instances For

    Decodes the UTF-16 code units of s, or returns an error with the index in s of the first unpaired surrogate.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      Decodes the UTF-16 code units of s, or returns none if s has an unpaired surrogate.

      Equations
      Instances For

        Decodes the UTF-16 code units of s, panicking if s has an unpaired surrogate.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          Decodes the UTF-16 code units of s, replacing each unpaired surrogate with U+FFFD.

          Equations
          Instances For

            Whether s is well-formed UTF-16, that is, has no unpaired surrogate.

            Equations
            Instances For