Crossplatform EURO sign?

Devin Asay devin_asay at byu.edu
Wed Jun 10 10:22:12 EDT 2009


On Jun 10, 2009, at 7:15 AM, klaus at major.on-rev.com wrote:

> Hi all,
>
> any hint on how to handle crossplatform EURO signs?
> I mean the euro sign is unfortunately NOT translated
> isotomac/mactoiso, so how do you handle user input of this
> (and other) character(s) in your crossplatform apps/stacks/databases?
>
> Not to mention of ERUO signs in label fields, when you do not
> want to loop over all fields and place the appropriate signs
> on "pre-/openstack".
>
> Any hints heavily appreciated, inm the meantime we use "EUR" ;-)

Hi Klaus,

HTMLtext is no good, because the ¤ entity, while Rev correctly  
renders it as a Euro sign on the Mac, on Windows it produces a generic  
currency sign.

That leaves us with unicode. The code point for the Euro sign is hex  
0x20AC, which is decimal 8364. Usually you get reliable results by  
using unicode escape entities in htmlText, but again htmlText fails  
us, because this doesn't work:

    set the htmlText of fld 1 to "<p>€"

The only reliable way I can see is UTF-8. On my Mac the UTF-8 ASCII  
equivalent string is €. But that's different on Windows, so I looked  
at the ASCII code points for the three characters. They are 226 130  
172. So I tried the following and it reliably rendered the Euro sign  
on both Mac and Windows (no Linux here for me to try, but it should  
work there, too.)

set the unicodeText of fld "euro" to \
  uniencode((numToChar(226) & numToChar(130) & numToChar(172)),"utf8")

That ought to work for you.

Regards,

Devin

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University




More information about the use-livecode mailing list