The point of this discussion is not how you create accented characters, but if this is an issue for regex.
I'll re-state the question i posed earlier: if you feed a string to regex either using the accented char or a 'unicode' combination, will regex treat this differently?
In an ideal world, no it wouldn't - in the real world things are a great deal more complicated - especially if you start looking at writing systems which aren't Roman-like (i.e. glyphs for a small number of letters, with some letters being base+diacritical).
I don't think so because a) regex doesn't read hex and b) regex doesn't read unicode codes, just text strings. However, i'm willing to be proven wrong, but I'd bet good money that this is not something you have tested and found to be a problem

The regex we use in LC (PCRE) deals with codepoints - these are the 'codes' in the Unicode character table which are used to build up characters, which then build up into strings.
The difference between codepoints and characters is precisely the topic that has given rise to this question - the different ways you can represent a single character - e.g. n-tilde can be the single codepoint n-tilde, or two codepoints n, then combining-tilde.
My comment is based on the fact that you no longer have to figure out or remember keyboard combos, which are different on different keyboard layouts and languages. The long-press has been there for a while and allows a more uniform and easy access regardless of keyboard setup. You may well be ultra-familiar with the keyboard combos to produce the desired characters on your keyboard, but what you do does not necessarily apply to anyone else. 'Better' means that everyone can access the same functionality with ease. Although not sure why i'd need to clarify that...
Its probably best not to make assumptions about how different people around the world enter their text - nor indeed, how the text they need to manipulate was constructed, or where it came from. Nor indeed what language they are typing in
Sure - if you are typing English, then the rare need for accented characters is probably well served by long-press on recent Apple IMEs, however, if you are typing in a language which uses such things (or indeed different things) frequently then it would probably become incredibly tiresome quickly. (e.g. Vietnamese vowels typically have multiple tone marks on each one...).
This is exactly my point. You can't produce a 'combination' version with the keyboard. The keyboard combos are just a trigger to the OS to produce the accented character. It may be possible to create the combo unicode in code, but a) does this produce two different distinct unicode codes? and b) i just can't see how this would be an issue for regex - where the developer will either be using text in handler or user-entered in a field.
Again best not to assume what a particular 'keyboard' on a particular platform might produce - or indeed what the OS does with the text after you've typed it and its gone and been stored in its particular context.
For example, macOS filenames will always used decomposed characters however they are entered - if you change the name of a file in Finder to `foé`, then copy the filename again - it will always be `f,o,e,combining-acute` and not `f,o,e-acute` (i.e. it will be four codepoints and not three).
The characters produced with a 'combining tilde' have their own discrete unicode codes, for example Ñ produced with a combining tilde has the unicode code of U+00D1. I can't see anywhere that Ñ can be represented with 2 different unicode codes although if that is the case please do point to a source for further reading.
Spanish has n-tilde - the tilde is a diacritic - its called a virgulilla (in Spanish). It is equally valid to represent it as n-tilde, or n+combining-tilde (in Unicode).
As an aside, the 'composed characters' which exist in Unicode today are the only ones which will ever exist in the standard (for the languages it already encodes) - there will never be any more (if they did it would change the normalization rules in a backwards-incompatible way). Any other characters (for any script) which are added which can be seen (by whatever metric the Unicode consortium uses) as 'base-character + overlaid marks' - will only be representable in a decomposed form. All combined forms which exist, previously existed in some 'legacy' language encoding and are there to ensure 100% round-tripping is possible (with a 1-1 mapping). You can see this rule has been applied already in Unicode - there are (polytonic?) greek characters missing some composed forms.
So back to regex:
It should be noted that on the whole this detail of *how* a character is represented in LiveCode is mostly hidden from you - its the domain of the 'formSensitive' property - the only place where the difference can become apparent (assuming you haven't fettled with that property) is the regex functionality (and array key access when caseSensitive is true - array keys are either exact match by codepoint, or case-folded match by character).
We did try numerous things to make matchText/Chunk and friends play well with caseSensitive and formSensitive - however, it ended up causing issues with some things - so the regex functions we have are a minimal wrapper around PCRE - you need to explicitly specify whether you want case-insensitivity (using (?i) at the front); and have to normalize unicode text first (if you are dealing with Unicode text - which you quite probably are not if you've just got Western European languages to deal with):
Code: Select all
put normalizeText(tPattern, "nfc") into tNormPattern
put normalizeText(tText, "nfc") into tNormText
I'm sure we'll return to these functions at some point to try and figure out how to make them a little more friendly and consistent with the rest of LC's string handling - but given issues (or uses of!) matching patterns containing characters against strings containing characters which have variant forms in Unicode has come up about two or three times in the last 8+ years, you can appreciate that it isn't exactly a huge priority
EDIT: I should point out the above is only relevant when using matchText/matchChunk/replaceText - if using 'filter with regex pattern' - then the engine does 'the right thing' - it handles formSensitive and caseSensitive for you - the reason *it* can do that is because it is only asserting the existence of a match on each line (or whatever chunk you requested) and thus what it has to do internally to make things work does not affect what script sees. The regex functions are lower-level - in particular, they (can) return and reference substrings, or change the input text and as such if the engine normalized (and indeed casefolded the text itself) it would not be consistent with how it operates on non-Unicode text thus is best left up to the scripter to control (for the time being, at least).