MacToISO is still confusing me

Martin Baxter mblivecode at harbourhosting.co.uk
Sun Dec 22 05:16:41 EST 2013


Graham,

This page shows the differences between mac roman, ansi and iso-8891

<http://www.alanwood.net/demos/charsetdiffs.html>

You will see that PI characters are one of the numerous differences.
obviously, mactoiso isn't magic and if there is no equivalent character
in the set, it cannot help.

I use html references for this.

π or π gives lowercase pi
Π or Π should give Capital PI

So you could

replace chartonum(185) with "π" in yourMacText

as a workaround. After putting yourMacText through mactosio() that is.
You would then wrap paragraphs with <p> and </p> and anything else you
need to do and then set the htmltext.

It will depend which version of livecode you are using. Recent versions
support the above references in htmltext, but older versions did not.

I just tried these with livecode 4.5 and 6.1

The above work in 6.1, but not in 4.5 which appears to use [character
position] mod 256 to produce an 8 bit value and displays the resulting
completely incorrect glyph as if that was somehow a helpful thing to do.
(e.g. π shows character 192 - Agrave instead of pi).

If you need to be thorough, you will want to cater for all the
differences between the character sets as shown in the alanwood.net link
above. What that page calls ANSI is, in practise, what mactoiso attempts
to translate to.

It should be possible to deal with this by converting to some flavour of
unicode I would think, but I can't help you with that.

Hope this helps

Martin BAxter




On 21/12/13 22:48, Graham Samuel wrote:
> In a last desperate attempt to avoid both HTML and Unicode in
> translating just a few key characters from Mac to PC, I'm trying to
> use the built-in function MacToISO, as suggested recently by Jacque
> Gay.
> 
> Sadly I'm having trouble. Take the Greek letter pi, often used in
> mathematics. There is a native Mac encoding for it, which turns out
> to be decimal 185. But if you do this in the LiveCode message box
> running on a PC:
> 
> put MacToISO(numToChar(185))
> 
> you don't get a pi symbol. This is not a good start.
> 
> The LC dictionary says that MacToISO translates those characters
> whose codes are above 127 from the Mac encoding to the Windows Latin
> 1 character set, which I assume is always available on PCs in Europe
> and the US (and maybe everywhere else). When I look up this character
> set in Wikipedia, it does contain the odd Greek letter, but not pi.
> And in fact there are very few maths symbols (no 'less than or equal
> to' or 'greater than or equal to', for example). So a lot of stuff
> easily available on the Mac just isn't there on PCs.
> 
> I hadn't expected this - am I doing something wrong? Probably, but
> I'd like to know what. Meanwhile, it's time for HTML, I suppose.
> 
> TIA for any clarification.
> 
> Graham _______________________________________________ use-livecode





More information about the Use-livecode mailing list