getting Str(Len(txt)) utf8

I have this line of code that in a sense returns the correct length. It isn’t UTF-8 sensitive though.
Text: “?? ?? ??? ?? ???.” Str(Len(txt)) returns 31 instead of 18 (I think). Am I missing something?
Do I have to put something like .textencoding on the end of it, even though it’s elsewhere?
It might be a calculation thing because I can get textarea.charposxandY to work without any calculations.
The problem is it’s an odd number. When I debug for an equal english text “He went on his way at daybreak.” I also get 31 when I bring up that text to find it’s length in the debugger.

Str(Len("?? ?? ???? ?? ???."))

returns “18”, compiling with the latest version of Xojo. (Using LenB rather than Len it returns “44”.)

It sounds like your string does not have an encoding, or has the incorrect encoding defined. Where is this string coming from? You might need to use txt = DefineEncoding(txt, Encodings.UTF8) to inform Xojo that this chunk of bytes should be interpreted as UTF-8.