Feeling a bit "NumToCharred"...

Mark Schonewille m.schonewille at economy-x-talk.com
Fri Dec 18 15:02:10 EST 2009


Hi Richmond,

If you use uniencode(space) or numToChar(32), it is solved. I'm not  
sure that this is a bug. If you want to use space as a delimiter in a  
binary stream consisting of uniencoded bytes, you might have a problem  
if && suddenly equals a uniencoded space. Of course, one might as well  
use a different delimiter --and one probably should.

I think I would do something like the following:

function toUnicode
   set the useUnicode to true
   repeat with x = 1 to the paramCount
     if param(x) is a number then
       put numToChar(param(x)) after myUnicode
     else
       put uniencode(param(x)) after myUnicode
     end if
   end repeat
   return myUnicode
end toUnicode

You can call the function as follows:

set the unicodeText of fld "Foo" to toUnicode(7749," a b c d")

I haven't tested this particular script, but such a solution might  
work, is quite easy to use and doesn't slow down things much.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer

Full PayPal integration and automation in web site or (Revolution/ 
SuperCard/other) software. Contact me for a quote before 1 Jan 2010  
and we'll charge (reduced) 2009 prices.
http://economy-x-talk.com/contact.html

Op 18 dec 2009, om 20:16 heeft Richmond Mathewson het volgende  
geschreven:

> Wl, here I go again; replying to my own message:
>
> useUnicode throws a tantrum with "&&", as it does with " ", so
> everything (which is incredibly tedious) has to be down the
> numToChar way (i.e. no mixt forms):
>
> on mouseEnter
>   set the useunicode to true
>   set the unicodeText of fld "GUFF" to numToChar(7749) &  
> numToChar(32) & numToChar(43)
> end mouseEnter
>
> -------------------------------
>
> What a pain in the bum!
>
> To my mind a mixt syntax, whereby characters accessible only via  
> numToChar could
> be mixt with those directly accessible via the keyboard would be  
> more intuitive.
>
> Compare:
>
> set the unicodeText of fld "GUFF" to numToChar(7749) && "a b c d."
>
> to
>
> set the unicodeText of fld "GUFF" to numToChar(7749) && "a" && "b"  
> && "c" && "d" & "."
>
> to
>
> set the unicodeText of fld "GUFF" to numToChar(7749) & numToChar(32)  
> & numToChar . . . . . . . . . . . . frankly cannot
> even be bothered to work it out . . . time for some coffee . . . z z z
>
> ---------------------------
>
> A mixt syntax would save me (even if no-one else) hours and hours of  
> typing, fiddling around with unicode numbers
> for trivial characters, and merry repetitive stress injury.




More information about the use-livecode mailing list