Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Utf8

UTF-8 Input/Output factory.

Hierarchy

  • Utf8

Index

Methods

Static decodedOutput

  • Returns a new Output that accepts UTF-8 code unit sequences, and writes writes decoded Unicode code points to the composed output, handling invalid code unit sequences according to the errorMode policy.

    Type parameters

    • T

    Parameters

    Returns Output<T>

Static decodedString

  • decodedString(): Output<string>
  • Returns a new Output that accepts UTF-8 code unit sequences, and writes decoded Unicode code points to a growable string, handling invalid code unit sequences according to the UtfErrorMode.fatal policy. The returned Output accepts an unbounded number of UTF-8 code units, remaining permanently in the cont state, and binds a string containing all decoded code points.

    Returns Output<string>

Static encodedOutput

  • Returns a new Output that accepts Unicode code points, and writes encoded UTF-8 code unit sequences to the composed output, handling invalid code unit sequences according to the errorMode policy.

    Type parameters

    • T

    Parameters

    Returns Output<T>

Static sizeOf

  • sizeOf(c: number | undefined, errorMode?: UtfErrorMode): number
  • sizeOf(c: number | undefined): number
  • sizeOf(string: string, errorMode?: UtfErrorMode): number
  • sizeOf(string: string): number
  • Returns the number of bytes in the UTF-8 encoding of the Unicode code point c, handling invalid code unit sequences according to the errorMode policy. Returns the size of the UtfErrorMode.replacementChar for surrogates and invalid code points, if UtfErrorMode.isReplacement is true; otherwise returns 0 for surrogates and invalid code points. Uses the two byte modified UTF-8 encoding of the NUL character (U+0000), if UtfErrorMode.isNonZero is true.

    Parameters

    Returns number

  • Returns the number of bytes in the UTF-8 encoding of the Unicode code point c; returns the size of the Unicode replacement character (U+FFFD) for surrogates and invalid code points.

    Parameters

    • c: number | undefined

    Returns number

  • Returns the number of bytes in the UTF-8 encoding the given string, handling invalid code unit sequences according to the errorMode policy.

    Parameters

    Returns number

  • Returns the number of bytes in the UTF-8 encoding the given string, assuming the Unicode replacement character (U+FFFD) replaces unpaired surrogates and invalid code points.

    Parameters

    • string: string

    Returns number