1

I need to display a text file with Unicode Big Endian encoding in Matlab's GUI. How can I do that?

I'm trying this code for UTF-8 encoded text file but it is not working for this format as well, it only displays english characters correctly, but the other characters are all jumbled up:

fid = fopen( 'file.txt','r','n','UTF-8');
str = textscan(fid, '%s', 'Delimiter','\n'); str = str{1};
fclose(fid);

hFig = figure('Menubar','none', 'Toolbar','none');
hPan = uipanel(hFig, 'Title','Your Required Directions', ...
    'Units','normalized', 'Position',[0.05 0.05 0.9 0.9]);
hEdit = uicontrol(hPan, 'Style','edit', 'FontSize',12, ...
    'Min',0, 'Max',2, 'HorizontalAlignment','left', ...
    'Units','normalized', 'Position',[0 0 1 1], ...
    'String',str);

Can someone please help me out in displaying Unicode Big Endian encoded text file in Matlab's GUI?

user3127389
  • 87
  • 1
  • 1
  • 6
  • 1
    The encoding that MS tools misleadingly describe as “Unicode big-endian” is actually `UTF-16BE`. Have you tried passing that encoding to `fopen` instead of `UTF-8`? – bobince May 06 '14 at 09:24
  • Related question: [Arabic/Persian label Matlab figure](http://stackoverflow.com/questions/22759100/arabic-persian-label-matlab-figure). Long story short - it's a known problem. Haven't tested it with the new hg2 though. – Dev-iL May 14 '15 at 11:08
  • possible duplicate of [MATLAB: how to display UTF-8-encoded text read from file?](http://stackoverflow.com/questions/6863147/matlab-how-to-display-utf-8-encoded-text-read-from-file) – Dev-iL May 14 '15 at 11:11

0 Answers0