title: MATLAB: how to display UTF-8-encoded text read from file?
body: <p>The gist of my question is this:</p>
  
  <blockquote>
    <p>How can I display Unicode characters in Matlab's GUI (OS X) so that they are properly rendered?</p>
  </blockquote>
  
  <p>Details:</p>
  
  <p>I have a table of strings stored in a file, and some of these strings contain UTF-8-encoded Unicode characters.  I have tried many different ways (too many to list here) to display the contents of this file in the MATLAB GUI, without success.  For example:</p>
  
  <pre><code>&gt;&gt; fid = fopen('/Users/kj/mytable.txt', 'r', 'n', 'UTF-8');
  &gt;&gt; [x, x, x, enc] = fopen(fid); enc
  
  enc =
  
  UTF-8
  
  &gt;&gt; tbl = textscan(fid, '%s', 35, 'delimiter', ',');
  &gt;&gt; tbl{1}{1}
  
  ans =
  
  ÎÎÎÎÎÎ Î£Î¦Î©Î±Î²Î³Î´ÎµÎ¶Î·Î¸Î¹ÎºÎ»Î¼Î½Î¾ÏÏÏÏÏÏÏÏÏÏ
  &gt;&gt; 
  </code></pre>
  
  <p>As it happens, if I paste the string directly into the MATLAB GUI, the pasted string is displayed properly, which shows that the GUI is not fundamentally incapable of displaying these characters, but once MATLAB reads it in, it longer displays it correctly.  For example:</p>
  
  <pre><code>&gt;&gt; pasted = 'ΓΔΘΛΞΠΣΦΩαβγδεζηθικλμνξπρςστυφχψω'
  
  pasted =
  
  
  &gt;&gt; 
  </code></pre>
  
  <p>Thanks!</p>