TLF editManager.overwriteText is deleting special characters

I’ve ran into a problem using the built in functions in editManager (flashx.textLayout.edit.IEditManager) where it is killing/removing/deleting special characters in a String when I use the function overwriteText() or insertText()

Here is an example function below (where textFlow is already set up elsewhere):
private var editManager:IEditManager;
textFlow.interactionManager = editManager;

private function updateText(myText:String):void {
editManager.selectAll();
editManager.overwriteText( myText );
}

If I try to use a special character, for example bullet dot. “•” it just removes it, while keeping most other text. Trying to add the escaped value just causes the full escaped code to appear in the text: “&# x2022;” (space added before “x” or else that shows as the bullet on this forum). Special angled quotes and apostrophes also get killed.

So, if myText = “Some special • characters ‘ ’ “ ”get removed!”;
what I end up seeing in my TLF looks like: “Some special characters get removed!”

And yes, those characters are supported by the embedded font I am using, in fact they show up fine if you do something like textFlow = TextConverter.importToFlow(value, TextConverter.TEXT_LAYOUT_FORMAT, config);

However, I want to update the text content only, and not lose the format/style of the textFlow, which is in a custom state. The editManager functions seem to work well for this, I just am surprised that they are removing the special characters. If anyone has a fix for this or suggestions please reply, thanks.

Also of note, most characters you can enter with shift on the keyboard do appear just fine such as ~!@#$%^&*(){} etc. it just seems to have problems with characters in a certain range, the kind you’d use Alt+ to make such as ƒ (Alt+159) the others I mentioned, and so on. Of course if the font doesn’t support certain characters it causes other issues, but I’m talking about characters that the font does support being removed.

OK, so I couldn’t find any answer to my problem even despite an extensive search and research, but I seem to have solved my own problem after a ton of trial and error… so in case anyone else ever has this problem, here is the solution. This is not at all intuitive, and it looks strange, but it works.

Supports line breaks and special characters.

import flashx.textLayout.operations.InsertTextOperation;

private function updateText(myText:String):void {
editManager.selectAll();
var ITO:InsertTextOperation = new InsertTextOperation(textFlow.interactionManager.getSelectionState(), dText);
ITO.doOperation(); // MUST DO THIS even though it say “You should not call doOperation() directly.“
editManager.insertText(””); // This makes the text appear
}

So I know it’s kind of an obscure issue, but if this helps even one person it’s worth mentioning!

Thanks for posting the answer! I was originally placed on the TLF team when the feature was being developed but I hated it so much, I asked to be moved somewhere else :P.