Skip to content

unicode2native

strings · scripts/strings/unicode2native.m

: bytes = unicode2native (str)
: bytes = unicode2native (str, codepage)

Encode text in a named character set.

str is a char row. A wide char (code units >= 128) is encoded from those units; a narrow char is encoded from its UTF-8 bytes. codepage names the target encoding (for example "UTF-16LE" or "ISO-8859-1"); when omitted or empty the system default encoding is used. The result is a uint8 row vector of the encoded bytes.