Inserting unicodeText into a unicode string? #3

Richmond richmondmathewson at
Mon Aug 30 06:34:28 CDT 2010

  On 8/30/10 1:25 PM, Mark Schonewille wrote:

>  Hi Richmond,
>  That's not true.
>  put length(uniencode(space))
>  -->   2

Right: having populated my textField like this:

set the unicodeText of fld "fTX" to numToChar(57233)&  numToChar(57333)
&  uniencode(space)&  numToChar(57219)&  numToChar(57207)&
numToChar(57833)&  numToChar(57153)&  numToChar(57001)&
numToChar(57010)&  numToChar(57551)&  numToChar(57123)&
numToChar(57616)&  numToChar(52119)&  numToChar(57209)&
numToChar(57200)&  numToChar(57456)&  numToChar(57789)&
numToChar(57000)&  numToChar(56789)&  numToChar(57545)&
numToChar(57171)&  numToChar(57222)&  numToChar(57111)&
uniencode(space)&  numToChar(57236)&  numToChar(57234)&  numToChar(57235)

[ err . . . sorry about that "mouthful" ]

I move the insertion point just after a space and run the following:

set the useUnicode to true
    put the word 4 of the selectedChunk into W4
    put (W4 - 1) into W5
    get charToNum(char W5 to W4 of fld "fTX")
    put it into UNIK
    set the unicodeText of fld "fW4" to numToChar(UNIK)
    put the word 2 of the selectedChunk into W2
    put (W2 + 1) into W1
    get charToNum(char W2 to W1 of fld "fTX")
    put it into UNIQ
    set the unicodeText of fld "fW2" to numToChar(UNIQ)
    put uniEncode("The insertion point is between '") into P1
    put uniEncode("' and '") into P2
    put uniEncode("'") into P3
    set the unicodeText of fld "fWH" to P1&  numToChar(UNIK)&  P2&
numToChar(UNIQ)&  P3

however the output (in fld "fWH") does not tell me my insertion point
is between ' ' and 'X'; but
gives me a "funny char" in the first position . . .

>  --
>  Best regards,
>  Mark Schonewille

Interestingly enough that problem goes away if one uses a completely unicode compliant font such as
'Last Resort'.

More information about the use-livecode mailing list