<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169189</link>
    <title>MATLAB Central Newsreader - Displaying Unicode using editor cell mode publish (utf-8 encoded</title>
    <description>Feed for thread: Displaying Unicode using editor cell mode publish (utf-8 encoded</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 13 May 2008 16:09:49 -0400</pubDate>
      <title>Displaying Unicode using editor cell mode publish (utf-8 encoded</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169189#431843</link>
      <author>Freelance Embedded Systems Engineer</author>
      <description>I have a UTF-8 encoded byte array consisting of the hexadecimal numerical values, for example the 3-byte array (a): &quot;E2 99 A0&quot;.  &lt;br&gt;
&lt;br&gt;
I can convert this array using &quot;b=native2Unicode(a,'UTF-8') to obtain a 2-byte character string, but I want to be able to view the result, (in this example, the Black Spade Suit character, Unicode 02660).&lt;br&gt;
&lt;br&gt;
Since I believe that Matlab can't display this in the command window[1], I would like to display this in the HTML results produced by the Publish process, (M-file editor cell mode option).  The resulting HTML file does have a &quot;meta&quot; definition in the &amp;lt;head&amp;gt; that includes:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;contents=&quot;text/html; charset=utf-8&quot;.&lt;br&gt;
&lt;br&gt;
So I'm trying to figure out what Matlab commands I need to issue in order to get the desired result from the UTF-8 encoded array, or if I need to learn about style sheets to get the desired result.&lt;br&gt;
&lt;br&gt;
Note&lt;br&gt;
[1] I've tried various desktop code fonts in the preferences including Arial Unicode MS which displays a square box for the desired result in the example below.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Example Matlab code&lt;br&gt;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - &lt;br&gt;
a=uint8([hex2dec('E2'),hex2dec('8C'),hex2dec('A0')])&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;226 140 160&lt;br&gt;
&lt;br&gt;
b=native2unicode(a,'UTF-8')&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;%nothing displayed in monospace fonts&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;%empty square box displayed in Arial Unicode MS&lt;br&gt;
&lt;br&gt;
whos&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Name  Size Bytes  Class&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;a     1x3    3    uint8&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;b     1x1    2    char&lt;br&gt;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Reference URLs:&lt;br&gt;
&lt;a href=&quot;http://isthisthingon.org/unicode/index.phtml?page=02&amp;subpage=6&amp;glyph=02660&quot;&gt;http://isthisthingon.org/unicode/index.phtml?page=02&amp;subpage=6&amp;glyph=02660&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://www.fileformat.info/info/unicode/utf8.htm&quot;&gt;http://www.fileformat.info/info/unicode/utf8.htm&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
g9u5dd43@yahoo.com</description>
    </item>
    <item>
      <pubDate>Tue, 20 May 2008 06:28:02 -0400</pubDate>
      <title>Re: Displaying Unicode using editor cell mode publish (utf-8 encoded</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/169189#433051</link>
      <author>Matthew Simoneau</author>
      <description>The only thing I can think of is to escape it yourself and&lt;br&gt;
then use the &amp;lt;html&amp;gt; tag to pass it straight through.  This&lt;br&gt;
code should get you started:&lt;br&gt;
&lt;br&gt;
a = uint8([hex2dec('E2'),hex2dec('8C'),hex2dec('A0')]);&lt;br&gt;
b = native2unicode(a,'UTF-8');&lt;br&gt;
c = uint16(b);&lt;br&gt;
fprintf('&amp;lt;html&amp;gt;&amp;#%.0f;&amp;lt;/html&amp;gt;\n',c)&lt;br&gt;
&lt;br&gt;
It seems like this should be handled automatically, but I&lt;br&gt;
need to do some more digging.</description>
    </item>
  </channel>
</rss>

