MATLAB: Do I get incorrect vector length using NATIVE2UNICODE command on Japanese Windows machine

japaneseMATLABnative2unicode.

I have a vector of length 1×8 and I am converting the vector to unicode using the command NATIVE2UNICODE in MATLAB 7.2 (R2006a). When I check the size of the converted unicode, MATLAB is returning the answer as 1×7. This behavior is not seen in English version of windows machine. It can be reproduced only on Japanese version of Windows.

Best Answer

Both NATIVE2UNICODE and UNICODE2NATIVE functions are designed to handle only valid character codes as inputs.
This problem can happen with certain encoding schemes, such as Shift-JIS, GBK or Big5. It occurs if non-supported character codes are input as character data. If a valid character code is detected at the leading-byte position but an invalid character code follows the leading-byte, NATIVE2UNICODE does not properly handle the character code sequence.