Convert numeric bytes to Unicode character representation
unicodestr = native2unicode(bytes)
unicodestr = native2unicode(bytes, encoding)
unicodestr = native2unicode(bytes) converts a
bytes, from the user default encoding to a
Unicode® character representation.
bytes as a vector of 8-bit bytes, and each value must be in the
range [0,255]. The output argument
unicodestr is a character vector
having the same general array shape as
unicodestr = native2unicode(bytes,
bytes to a Unicode representation with the assumption that
bytes is in the
character encoding scheme specified by
encoding. The input argument
encoding must have no characters (
'') or it
must be a name or alias for an encoding scheme. Some examples are
encoding is unspecified or has no characters
''), the default encoding scheme is used.
encoding can be a character vector or a string scalar.
bytes is a character vector or a string scalar, it is
This example begins with a vector of bytes in an unknown character
encoding scheme. The user-written function
the encoding scheme. If successful, it returns the encoding scheme
name or alias as a character vector. If unsuccessful, it throws an
error represented by an MException object,
The example calls
native2unicode to convert the
bytes to Unicode representation:
try enc = detect_encoding(bytes); str = native2unicode(bytes, enc); disp(str); catch ME rethrow(ME); end
Note that the computer must be configured to display text in
a language represented by the detected encoding scheme for the output
disp(str) to be correct.
backgroundPoolor accelerate code with Parallel Computing Toolbox™
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.