Flex TextArea - 从Word复制/粘贴 - xml解析中的unicode字符无效 [英] Flex TextArea - copy/paste from Word - Invalid unicode characters on xml parsing

查看:280
本文介绍了Flex TextArea - 从Word复制/粘贴 - xml解析中的unicode字符无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:

请访问这里:



似乎成为问题&需要为此找到一个解决方案。

ORIGINAL:

我们有一个应用程序,用户可以创建一个电子邮件消息&发送给不同的用户。我们将该电子邮件创建为XML消息(发件人,目的地,主题,正文等)和把它放在队列中。



另一个应用程序接收消息,解析消息&发送电子邮件。我们无法控制它。

现在问题出在测试期间,我们的测试人员复制/粘贴Word&使用它。现在,可能有一些无效的字符(在换行符或制表符)在解析器中失败。错误是:

$ p $ 属性值BODY中的字符无效(Unicode:0x1A)

现在我们需要防止发送这些无效的字符。所以我尝试使用textArea的限制。在creationComplete上是这样的:

  contentTextArea.restrict =AZ az 0-9。,!@#$%*  -  + [] {}()/'\\\␤\\; 

但是不行。当我删除\\\␤ \它可能工作,但它拿出所有新行。所以,我需要使用正则表达式替换?



任何帮助,将不胜感激。



试用的文本是:

 应用程序不同的一个区域非常安全。在角色中添加或删除权限不需要部署,只需一个数据修复即可。 

在开发期间,通知用户的观众。因此,在两个系统之间没有任何机制可以迁移。本文档的目的是概述两种将两个应用程序之间的用户基础同步的策略。

在这个文本上有标签/新行等。



非常感谢

Harish

解决方案 div>

我能够通过使用textArea changingHandler来处理它,只允许某些字符:

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


EDIT:

Please visit here:

Flex textArea remove/replace invalid little squares

Seems to be the issue & need to find a solution for this.

ORIGINAL:

We have an application where users can create an email message & send it to different users. We create the email message as an XML message (sender, destination, subject, body, etc.) & put it on the queue.

Another application picks up the message, parses it & sends out the emails. We have no control over it.

Now the problem is during testing, our tester copied/paste some text from Word & used it. Now that probably has some invalid characters (on new line or tab) that is failing in the parser. The error is :

Invalid character in attribute value BODY (Unicode: 0x1A) 

So now we need to prevent sending these invalid chars. So I tried using textArea restrict. Something like this on creationComplete:

contentTextArea.restrict = "A-Z a-z 0-9 .,!@#$%*-+[]{}()/' \u2424\\";

But does not work. When i remove \u2424\ it probably works, but it takes out all new lines. So do I need to use regex replace?

Any help on this would be appreciated.

The text tried was:

One area where the applications differ greatly is security.  Adding or removing a Permission within a Role does not require a deployment, simply a ‘data fix’.

During development it was communicated that the audience of users .  As such there was no mechanism constructed to migrate between the two systems.  The purpose of this document is to outline two strategies for bring the user base between the two applications into sync.
 

There are tabs/new lines, etc. on this text.

Thanks so much

Harish

解决方案

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 - 从Word复制/粘贴 - xml解析中的unicode字符无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆