Menu

#24 Missing support for unicode characters since v7

master
closed-wont-fix
nobody
5
2014-05-16
2014-05-09
No

There are some problems with matio, Matlab and unicode characters.
I am using Matlab R2014a and I am trying to store the variable

x = char(253:258)

I cannot get this to run on Octave 3.6.2 because of the values exceeding 255, but on Matlab I can assign this variable.
From the history of the mat-format (see http://www.mathworks.com/help/matlab/ref/save.html#inputarg_version) I found that Matlab supports 16-bit unicode characters with v7 and v7.3. Strangely you don't get a warning when saving the above variable with v6 and v4. Instead I get the following output:

>> x = char(253:258); double(x), save('v4.mat', 'x', '-v4'); load('v4.mat'); double(x)

ans =
   253   254   255   256   257   258

ans =
   253   254   255     0     1     2

>> x = char(253:258); double(x), save('v6.mat', 'x', '-v6'); load('v6.mat'); double(x)

ans =
   253   254   255   256   257   258

ans =
   253   254   255    26    26    26

>> x = char(253:258); double(x), save('v7.mat', 'x', '-v7'); load('v7.mat'); double(x)

ans =
   253   254   255   256   257   258

ans =
   253   254   255   256   257   258

>> x = char(253:258); double(x), save('v73.mat', 'x', '-v7.3'); load('v73.mat'); double(x)

ans =
   253   254   255   256   257   258

ans =
   253   254   255   256   257   258

But matio doesn't seem to support anything but 8bit characters.
Reading the file v4.mat it correctly imports the same data mod 256 as Matlab.
Reading the file v6.mat it imports the data and the char(26) values just like Matlab as well.
But reading the file v7.mat it imports only 6 char(0)-values.
And reading the file v73.mat it imports min(x, char(255)).

Discussion

  • cch

    cch - 2014-05-11

    Adding unicode support would not be trivial. While it might be nice, I have personally not come across a case requiring it. If someone worked a series of patches I would definitely consider it, but probably will not be implementing myself.

     
  • cch

    cch - 2014-05-16
    • status: open --> closed-wont-fix
     

Log in to post a comment.