Going Mad With Unicode
Igor Couto
igor at pixelmedia.com.au
Wed May 28 04:33:01 EDT 2003
Dear Jan,
Thank you for your prompt suggestion!
> You can't set the unicodeText or htmlText of an
> individual line ; they're 'all or nothing' properties
> for the entire field.
Hmmm, interesting... I thought you COULD set the htmlText property on a
line-by-line basis, because if I try:
set the htmlText of line 2 of field "targetf" to the htmlText of field
"sourcef"
That does not give me an error. However, if I try:
set the unicodeText of line 2 of field "targetf" to the unicodeText of
field "sourcef"
It does...
> However, this workaround might do the trick :
>
> put the htmlText of fld "source" into tSource
> put the htmltext of fld "target" into tTarget
> put tSource into line 2 of tTarget
> set the htmlText of fld "target" to tTarget
>
I rushed back to my stack, eager to try your suggestion. Unfortunately,
the result was the same as:
set the htmlText of line 2 of field "targetf" to the htmlText of field
"sourcef"
The extended characters are either wrong, in 'blank boxes', or not
displayed at all...
Again, if I check the 'htmlText' of that line, I can see that
Revolution DID copy some characters in those positions, but they are
NOT THE SAME characters as the ones in the source field (their html
escape sequences are different!). It is doing something when in PASTES
the text back in the field...
> Most of the time, line i of the htmltext corresponds
> to line i of the text ; if not, you'll have to do some
> funny things with
> offset("<p>", tTarget)
> offset("</p>", tTarget)
> to find out where line i of the text starts and ends
> in the htmlText.
>
The lines seem to behave well when I use the htmlText property.
However, they go ALL OVER THE PLACE if I use the unicodeText instead.
See, here is me trying to be clever - I thought I'd try your suggestion
with the 'unicodeText' property:
put the unicodeText of field "sourcef" into theSource
put the unicodeText of field "targetf" into theTarget
put theSource into line 2 of theTarget
set the unicodeText of field "targetf" to theTarget
In my test, "targetf" was 6 lines long. Much to my surprise, this
script DID copy the right characters into line 2 of the target!
However, after line 2, ALL CHARACTERS TURNED TO JAPANESE! *hehehehehe*
This is reproducible, and always happens right after the 'pasted' line
- ie, if I change the 3rd line of the script to say "put theSource into
line 4 of theTarget", then the source field ends up OK up until the end
of line 4, and then it's just japanese gobbledigook!
Jan, do you have any suggestions? It feels like we're getting close,
here!
--
Igor
----------------------------------
igor at pixelmedia.com.au
----------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2928 bytes
Desc: not available
URL: <http://lists.runrev.com/pipermail/use-livecode/attachments/20030528/0a26ac8f/attachment.bin>
More information about the use-livecode
mailing list