Characters are (normally) represented as 2-byte UTF-16 integers, covering the BMP subset of Unicode.
Strings are a asequence of 16-bit integer values. Normally this would be a sequence of UTF-16 encoded characters.
However, there is also the function
to convert strings to normal form.
socket.write() by default writes a string in UTF-8
For reading, the socket can have its encoding set by
To convert between strings and byte arrays has been discussed at Stackoverflow How to convert UTF8 string to byte array?
The node.js Punycode moduke has been deprecated and instead recommended to use the user-supplied punycode.js module at A robust Punycode converter that fully complies to RFC 3492 and RFC 5891. .
Copyright © Jan Newmarch, firstname.lastname@example.org
Based on a work at https://jan.newmarch.name/NetworkProgramming/ .