Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "string/utf16-to-utf8-array/docs/types/index.d"

Index

Functions

Functions

Export assignment utf16ToUTF8Array

  • utf16ToUTF8Array(str: string): Array<number>
  • Converts a UTF-16 encoded string to an array of integers using UTF-8 encoding.

    Notes

    • The following byte sequences are used to represent a character. The sequence depends on the code point:

      0x00000000 - 0x0000007F:

       0xxxxxxx

      0x00000080 - 0x000007FF:

       110xxxxx 10xxxxxx

      0x00000800 - 0x0000FFFF:

       1110xxxx 10xxxxxx 10xxxxxx

      0x00010000 - 0x001FFFFF:

       11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
    • The x bit positions correspond to code point bits.

    • Only the shortest possible multi-byte sequence which can represent a code point is used.

    see

    UTF-8

    see

    Stack Overflow

    Parameters

    • str: string

      string to convert

    Returns Array < number >

    array of integers

    Example

    var str = '☃';
    var out = utf16ToUTF8Array( str );
    // returns [ 226, 152, 131 ]