On this page

P

punycode.ucs2

History
M

punycode.ucs2.decode

History
punycode.ucs2.decode(string): void
Attributes
string:string

The punycode.ucs2.decode() method returns an array containing the numeric codepoint values of each Unicode symbol in the string.

punycode.ucs2.decode('abc'); // [0x61, 0x62, 0x63]
// surrogate pair for U+1D306 tetragram for centre:
punycode.ucs2.decode('\uD834\uDF06'); // [0x1D306]
M

punycode.ucs2.encode

History
punycode.ucs2.encode(codePoints): void
Attributes
codePoints:integer[]

The punycode.ucs2.encode() method returns a string based on an array of numeric code point values.

punycode.ucs2.encode([0x61, 0x62, 0x63]); // 'abc'
punycode.ucs2.encode([0x1D306]); // '\uD834\uDF06'