Hello Ben,

Thank you for your detailed answer.

So far, I only have to deal with french text so I only need
a list of diacritic vowels and a list of the chars used as
replacement :
àâäéèêëîïôöùûüÿ
aaaeeeeiioouuuy
With a simple loop it is feasible and it doesn't slow down
my scripts significantly.
But indeed, a 'diacriticSensitive' property would be really
helpful.

jbv



Le 2022-09-27 06:22, Ben Rubinstein a écrit :
Hi jbv,

This one of a number of gaps that exist in the jungle of character
processing in LiveCode.

I don't think there is a 'diacriticSensitive' property. Some part of
LiveCode are clever about accents, see e.g.
https://quality.livecode.com/show_bug.cgi?id=15312
https://quality.livecode.com/show_bug.cgi?id=15443

As you note, it would be useful if there was a built-in function to
strip diacritics, which has been requested (for 14 years now):
https://quality.livecode.com/show_bug.cgi?id=6450

One trick that can be used in some contexts is to put the text into a
field, retrieve the htmlText of the fields - which encodes many
accented characters as entity names - and reduce these entity names
back to the unaccented character.

There's also an enhancement request (pending for over 18 years) to
expose this functionality without the need to use a field - useful for
many purposes, not just for stripping accents:
https://quality.livecode.com/show_bug.cgi?id=1372

This especially ought to be a cheap enhancement, since LC evidently
incorporates the necessary tables already.

Putting text through html entities is not a perfect solution to
implementing a "stripDiacritics" function, because e.g. you might
render "—" as "m"; but as far as I know, currently it's either
that or encode your own tables.

Ben


On 16/09/2022 15:10, jbv via use-livecode wrote:
Hi list,

Is there a way to ignore accented characters in LC, like in mySQL
for instance ?
Here's an example : I need these 2 array items below to be considered
as 1 single entity :
   add 1 to myArray["interprétation"]
   add 1 to myArray["interpretation"]

Of course, I can write a function that removes accents, but I was
wondering if there was a built-in function in LC to do that, in a
similar logic as "set the casesentive to false" for instance.

Thanks you in advance.
jbv

_______________________________________________
use-livecode mailing list
use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to