double byte chars?

Richmond Mathewson richmondmathewson at gmail.com
Sat Jun 11 14:23:39 EDT 2011


On 06/11/2011 09:14 PM, Lars Brehmer wrote:
> My project has Russian text fields (Arial,Russian). With one exception, everything works fine.
>
> Problem: a filter-as-you-type script.
>
> field "t1":     зо
> field "t2":     меня зовут Виктор  --underscoring shows the matches--
> field "t3":     зовут курить почему
>
> I want to do is find a word in fields t2 and t3 that begins with the 2 letters in field t1. Word 2 in field t2 and word 1 in field t3 should be matches. But this only works if the matching word is the first word in the field!
>
> Some simple message box scripts:

At the risk of insulting you, as you are using Unicode I have a funny 
feeling you have to
prefix this sort of this with

set the useUnicode to true
> put fld "t1"&  cr&  fld "t2"&  cr&  fld "t3"
>
> The result is a bunch of numbers, symbols and squares. You can clearly spot the matches.
>
> Next in the message box:   --char 1 to 4 -- double byte chars--
>
> put char 1 to 4 in fld "t1" into aText
> put char 1 to 4 in word 2 in fld "t2" into bText
> put char 1 to 4 in word 1 in fld "t3" into cText
> put aText&  cr&  bText&  cr&  cText
>
> This should be 3 identical lines, right? But no. Line 2 is missing the final char.
>
> 7(square)>(square)
> 7(square)>
> 7(square)>(square)
>
> Next: comparing the strings
>
> if cText = aText then beep - it beeps
> if cText is in aText then beep - it beeps
> if bText = aText then beep - no beep, obviously
>
> BUT
>
> if bText is in aText then beep - also no beep!
>
> And then
>
> put char 1 to 5 in word 2 in field "t2", it returns the same as the other two:
>
> 7(square)>(square)
>
> so then
>
> put char 1 to 5 in word 2 into bText
>
> but
>
> if bText = (or is in) aText still returns nothing
>
> Why is that last double byte char always missing when the word is not word 1 in its field? If I do char 1 to 3 I get this (again!)
>
> 7(square)>
> 7(square)   --last char missing!
> 7(square)>
>
> Using itemDEL = space and char 1 to x in item z behaves the same.
>
> Anyone know the answer?
>
> Cheers,
>
> Lars
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list