I'm not even sure if the problem lies with Keyboard Maestro or with the app I'm pasting from or pasting to.
In any case, I'd like to add a step to these macros to ensure that problems like that, if they occur, get fixed automatically.
So far, I've done it using the Search & Replace action.
But what's annoying about this is that I need one action for each character. So, for the characters from the above example, I'd need 15 actions. That is not only cumbersome to set up, but also clutters up the macro.
I would like a solution where I have one row of "from" values, and one row of "to" values, and then tell Keyboard Maestro to replace line by line. This would create less clutter, and would make it easier to add new characters later on.
You're on the right track; an array is indeed what you want in this case. Here's the simplest way I could think of to do this with native KM actions (i.e. no scripting):
Essentially, the LocalCounter variable is used to keep each line of the LocalTo variable in sync with the current line being processed in the For Each action, and the Return is used to make the array's delimiter a new-line character instead of the default comma (in KM, %Return% can be used as a substitute for a new-line character, i.e. what is inserted when the Enter/Return key is typed, but in a calculation field like a variable array, the surrounding % characters are not necessary).
Hopefully this all makes some semblance of sense! As always, feel free to ask any further questions you may have.