TextStoreage Range acts weird when there's fractions in the text?

I have a script to replace selected glyphs with a kerning context for each glyph, the script is supposed to replace all the text in the tab. It works for everything except fractions, the behaviour is strange when there’s fraction, it’s like it doesn’t get the full range of text.

I made a simplified version here:

Result if I selected

in a tab that only had abc and ran it:


Result if I selected
in a tab that only contained this text:

dd/zero.numr bonn
dd/one.numr bonn
dd/two.numr bonn
dd/three.numr bonn
dd/four.numr bonn
dd/five.numr bonn
dd/six.numr bonn
dd/seven.numr bonn
dd/eight.numr bonn
dd/nine.numr bonn

It keeps the last 5 strings from the selected string for some reason?

Another strange input:
ł/l.ss01 turns into

dd/l.ss01 bonn

Screen Shot 2023-06-06 at 4.28.29 pm

If you access the text, you need to escape the unencoded glyphs with slashes. Until the following space or slash, it is the glyph name.

But if you aim to replace the complete text anyway, why not simply set tab.text="abc"?

That’s a good solution, thank you