Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!69.16.185.51.MISMATCH!tmp-post01.iad!news.highwinds-media.com!roadrunner.com!not-for-mail
Date: Tue, 13 May 2008 12:09:49 -0400
From: Freelance Embedded Systems Engineer <g9u5dd43@yahoo.com>
User-Agent: Thunderbird 2.0.0.14 (Windows/20080421)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab
Subject: Displaying Unicode using editor cell mode publish (utf-8 encoded
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 38
Message-ID: <4829bcf2$0$4073$4c368faf@roadrunner.com>
Organization: Road Runner High Speed Online http://www.rr.com
NNTP-Posting-Host: 75.186.97.141
X-Complaints-To: abuse@rr.com
Xref: news.mathworks.com comp.soft-sys.matlab:468189



I have a UTF-8 encoded byte array consisting of the hexadecimal numerical values, for example the 3-byte array (a): "E2 99 A0".  

I can convert this array using "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).

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 "meta" definition in the <head> that includes:

    contents="text/html; charset=utf-8".

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.

Note
[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.


- - - - - - - - - - - - - - - - - - - - - - - - - - - - 
         Example Matlab code
- - - - - - - - - - - - - - - - - - - - - - - - - - - - 
a=uint8([hex2dec('E2'),hex2dec('8C'),hex2dec('A0')])
     226 140 160

b=native2unicode(a,'UTF-8')

    %nothing displayed in monospace fonts
    %empty square box displayed in Arial Unicode MS

whos
    Name  Size Bytes  Class
    a     1x3    3    uint8
    b     1x1    2    char
- - - - - - - - - - - - - - - - - - - - - - - - - - - - 



Reference URLs:
http://isthisthingon.org/unicode/index.phtml?page=02&subpage=6&glyph=02660
http://www.fileformat.info/info/unicode/utf8.htm

g9u5dd43@yahoo.com