Getting rid of Unicode characters

Richmond richmondmathewson at gmail.com
Wed Feb 19 03:02:57 EST 2014


On 19/02/14 03:18, Robert Sneidar wrote:
> Plaintext will not remove characters, which is what he wants. What he REALLY wants is something to remove ann non-printing characters from a chunk. I cannot help but believe there is a regex way to do this.

I have a stack that demonstrates how to filter characters (in fact, as 
with almost all of my work, the whole thing is moronically simple):

It consists of a card with 3 field; fORIGIN, fLIST and fOUTPUT 
(reasonably self-explanatory names).

fORIGIN contains one's UR-text, fLIST contains a string of characters 
one wishes to keep, and fOUTPUT is where one puts the filtered text.

There is a button, called "Button" (not trying to win any prizes here) 
that contains this script:

on mouseUp
    if fld "fLIST" contains the first char of fld "fORIGIN" then
       put the  first char of fld "fORIGIN" after fld "fOUTPUT"
       delete the first char of fld "fORIGIN"
    else
       delete the first char of fld "fORIGIN"
       end if
end mouseUp

as you can see it is fairly goofy; all it does is pick up the first char 
in fld fORIGIN and see whether it matches one of the chars in the string
in fld fLIST: if it is it plonks that char into fld fOUTPUT, and if not 
it just deletes it.

This button does not contain a loop (i.e. it checks one char per click), 
but with a repeat loop it could chew its way through
a great long text fairly quickly.

It is available here: http://forums.runrev.com/viewtopic.php?f=5&t=19188

I am sure one could do the same thing by comparing a string (say 
"$ORIGIN") with another string (say "$LIST") in much the same way;
but as my psychological development got stuck at the "seeing is 
believing" stage, I stuck with fields :)

------------------

Obviously, any characters that are not in the LIST (whether field or 
string) will get chucked away, whether they are Armenian characters or 
non-printing ones.

My example, just to make things screamingly obvious, has the list of 
English consonants in the fld fLIST, so on repeated button clicking it 
strips
the predictable sentence (The quick brown fox jumps over the lazy dog) 
of BOTH the vowels AND the spaces.

Richmond.

>
> Bob
>
>
> On Feb 18, 2014, at 10:04 AM, Devin Asay <devin_asay at byu.edu> wrote:
>
>> Skip,
>>
>> Have you looked at the plaintext property of fields? I think it converts non-convertible characters to a '?' It might be a tool you could use.
>>
>> Devin
>>
>> Sent from my iPhone
>>
>>> On Feb 17, 2014, at 2:20 PM, "Magicgate Software - Skip Kimpel" <skip at magicgate.com> wrote:
>>>
>>> Thank you!  This should give me something to go on.
>>>
>>>
>>> On Mon, Feb 17, 2014 at 3:51 PM, Richmond <richmondmathewson at gmail.com>wrote:
>>>
>>>> On 17/02/14 22:15, Magicgate Software - Skip Kimpel wrote:
>>>>
>>>>> Is there a way to scan a field for "extra" characters or non-English
>>>>> characters?  I am trying to create a verification process for some
>>>>> imported
>>>>> text and get rid of these characters in one swoop.
>>>>>
>>>>> Any guidance here would be greatly appreciated.... as always!
>>>>>
>>>>> Thanks again,
>>>>>
>>>>> SKIP
>>>> Have a play around with my stack available here: http://forums.runrev.com/
>>>> viewtopic.php?f=5&t=18869
>>>>
>>>> Richmond.
>>>>
>>>> _______________________________________________
>>>> 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
>>> _______________________________________________
>>> 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
>> _______________________________________________
>> 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
>
> _______________________________________________
> 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