Flex textArea remove/replace invalid little squares

半腔热情 提交于 2019-12-11 18:15:02

问题


This is related to my previous Flex issue:

Flex TextArea - copy/paste from Word - Invalid unicode characters on xml parsing

But this is slightly different & seems to be the issue. So I had to create another thread for this.

When I copy/paste text from word to a text area, I do not see any invalid characters. But when I pasted the same text on this url:

http://blog.flexexamples.com/2008/03/07/preventing-line-feeds-in-a-textarea-control-in-flex/

I'm seeing a little square " ". Please paste this text into the URL:

Bring the user base between the two applications into sync.
 
2.    Requirements

and you should be able to see the same. Now I want to remove this invalid character/symbol. Is there any way to do it. I think this is the problem for my xml parser issue.

Thanks


回答1:


I was able to handle it by using the textArea changingHandler to allow only certain characters:

    if (event.operation is PasteOperation)
        {
            event.preventDefault();
            var txt:String = Clipboard.generalClipboard.getData(ClipboardFormats.TEXT_FORMAT).
                            toString().replace(/[^A-Za-z0-9\s$%&*!@-_().]/ig, "");
                 ......
        }


来源:https://stackoverflow.com/questions/13020958/flex-textarea-remove-replace-invalid-little-squares

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!