Unfortunately, I don't really get how unicode works, as I have never had to make use of it regularly. Maybe someone who knows more can help here. What happens when you step through it in the debugger?

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


On Apr 6, 2010, at 12:27 PM, Richmond Mathewson wrote:

On 06/04/2010 14:57, Peter Brigham MD wrote:
Try this? Untested but should work. (The untested part is the first handler -- the offsets() function I have been using for years.)

on mouseup
  set the useUnicode to true
  put numtochar(57888) into targetChar
  put the unicodetext of fld "FIRST" into uText
  put offsets(targetChar,uText) into offsetList
  if offsetList = 0 then exit mouseup
  repeat for each item i in offsetList
     put char i+1 of uText & targetChar into \
                char i to i+1 of uText
  end repeat
  set the unicodetext of fld "FIRST" to uText
end mouseup

function offsets str,cntr
  -- returns a comma-delimited list
  -- of all the offsets of str in cntr
  if str is not in cntr then return 0
  put "" into offsetList
  put 0 into startPoint
  repeat
     put offset(str,cntr,startPoint) into thisOffset
     if thisOffset = 0 then exit repeat
     add thisOffset to startPoint
     put startPoint & comma after offsetList
  end repeat
  delete last char of offsetList
  return offsetList
end offsets

Unfortunately does not work, but

in my fld "FIRST", which initially contains 4 unicode chars, outputs 2 unicode chars.

Probably something to do with the fact that those are 4 double-byte chars.

This is where "Keeps Death his court and there the antic sits"; the antic being the problem
with double-byte characters:

"Scoffing his state and grinning at his pomp,
Allowing him a breath, a little scene,
To monarchize, be fear'd and kill with looks,"

and mysen fair forjeskit . . . :( an blackafrontit tae! whit a scunner.

I was monarchizin a bit, so pleased with my unicode "exchange" script, but
the antic (as usual) scoffed most effectively at my self-assumed pomp.
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to