Kingme Posted October 7, 2008 Posted October 7, 2008 I'm looking for a way to strip or filter out "accent marks" like this é The below code strips out the entire character. Filter( yourTextFieldHere ; "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`~!@#$%^&*()_+=-[];',./{}|:"<>? " ) Wondering if there is an alternative way to strip out the accent mark but keep the character?
Ocean West Posted October 7, 2008 Posted October 7, 2008 convert the accent to the real character like substitute ( text ; "é" ; "e" )
Kingme Posted October 7, 2008 Author Posted October 7, 2008 That's assuming you know what the character is. This is a calculation field that would strip the accent mark and leave the character (whatever that would be.
Ocean West Posted October 7, 2008 Posted October 7, 2008 perhaps some creative use of http://www.briandunning.com/cf/175 or http://www.briandunning.com/cf/285
Ocean West Posted October 7, 2008 Posted October 7, 2008 you would have to create a nested substitute such as Substitute (text ; ["å" ;"a" ]; ["é" ; "e"] ;[ "ü"; "u"] ) basically a set for every accent you wish to substitute.
Kingme Posted October 7, 2008 Author Posted October 7, 2008 Hmm. I'll take a look at both options, luckily most accents are on the "vowels" (atleast for the characters I'm dealing with) Thanks for the suggestions, I'm sure one of them will work just fine.
comment Posted October 8, 2008 Posted October 8, 2008 The only way to do this in Filemaker is by multiple substitutes - which means you have to actively list all possible accented characters. There may be another way to do this outside of Filemaker - search for "Unicode decompose".
FredBloggs Posted October 2, 2013 Posted October 2, 2013 Yeah… I know this topic is a bit old, but this might help someone. Multiple substitutes is not the only way to do this in Filemaker. Filemaker talks AppleScript which opens the whole world ! OK Comment, strictly speaking you are doubly right. AppleScript is "outside of Filemaker" even if you write it inside, and the way to go is indeed Unicode manipulation Perl does this very well, and you can call Perl from AppleScript from Filemaker. Twisted or what !? You need a temporary field in Filemaker to pass in the string you want to check, as you can't pass variables directly to AppleScripts (yet?). As from there, in your verification script just include a "Do AppleScript" line, with the following in the script section : set the_string to field "VarTemp" of current record set p_script to ¬ "# -*- coding: utf-8 -*- import unicodedata, sys def normalize(x): normal_form_1 = 'NFKD' normal_form_2 = 'NFC' x = unicodedata.normalize(normal_form_2, x) x = x.lower() x = x.replace(u'ß', u'ss') x = x.replace(u'å', u'aa') x = unicodedata.normalize(normal_form_1, x) x = u''.join([c for c in x if not unicodedata.combining©]) x = x.encode('utf-8') return x arg = sys.argv[1].decode('utf-8') x = normalize(arg) print x" set p_script to quoted form of p_script set the_string to quoted form of the_string set the_result to (do shell script ("python -c " & p_script & " " & the_string)) set field "VarTemp" of current record to the_result * "VarTemp" being the temporary field that you set up in Filemaker. Credits to Jürgen Schell for the Python/AppleScript work. I merely integrated it into Filemaker
comment Posted October 2, 2013 Posted October 2, 2013 Filemaker talks AppleScript which opens the whole world ! Well, Filemaker talks AppleScript - but only when running on a MacOS platform, so strictly speaking ... Still, I suppose you could run a very similar code in Java using the ScriptMaster plugin. So now the only remaining question is what is this good for.
Recommended Posts
This topic is 4127 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now