Flex textArea删除/替换无效的小方块 [英] Flex textArea remove/replace invalid little squares
问题描述
Flex TextArea - 从Word复制/粘贴 - xml解析中的unicode字符无效
不过,这个略有不同。似乎是问题。所以我不得不为此创建另一个线程。
当我从文本复制/粘贴文本到文本区域时,我看不到任何无效的字符。但是,当我粘贴在这个网址相同的文字:
http://blog.flexexamples.com/2008/03/07/preventing-line-feeds-in-a-textarea -control-in-flex /
我看到一个小方块。请将此文本粘贴到URL中:
将两个应用程序之间的用户基础同步。
2.需求
和你应该可以看到一样的。现在我想删除这个无效的字符/符号。有没有办法做到这一点。我认为这是我的xml解析器问题。
$ b
谢谢
if(event.operation is PasteOperation)
{
event.preventDefault();
var txt:String = Clipboard.generalClipboard.getData(ClipboardFormats.TEXT_FORMAT)。
toString()。replace(/ [^ A-Za-z0-9 \s $%& *!@ -_()。] / ig,);
......
}
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
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, "");
......
}
这篇关于Flex textArea删除/替换无效的小方块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!