简体   繁体   English

从字符串中删除未知隐藏字符

[英]Remove unknown hidden characters from string

I have an application (written in Clarion) that accepts user input and that input gets saved to a sql database. 我有一个接受用户输入的应用程序(用Clarion编写),并且该输入被保存到sql数据库。 Then those records get processed and sent to a server via web service (written in C#). 然后处理这些记录并通过Web服务(用C#编写)发送到服务器。 But sometimes the web service gives a bad request exception on text that contains invalid characters and are invisible in sql. 但有时Web服务会对包含无效字符的文本提供错误的请求异常,并且在sql中不可见。

When I copy paste the sql field into notepad++ it shows the 'character'. 当我复制粘贴sql字段到notepad ++时,它会显示'character'。

无效的字符

We suspect this issue occurs when a user copy and pasted text from Outlook in the input field. 我们怀疑当用户在输入字段中复制并粘贴Outlook中的文本时会发生此问题。

How can I handle this problem? 我该如何处理这个问题? I cant use text.replace as I don't know what to search for in the first place. 我不能使用text.replace,因为我不知道首先要搜索什么。 Is there an all round remove invalid characters from string or a convert to plain text function? 是否全面从字符串中删除无效字符或转换为纯文本函数? But things as carriage return should remain. 但是回车的事情应该保留下来。 Some uni-code 16 to uni-code 8 conversion maybe? 有些uni-code 16到uni-code 8转换可能?

A little lost on this one. 在这一点上有点迷失。 Thanks 谢谢

US is Unit Separator. US是单位分离者。 This is 0x1f or 31. You may try 这是0x1f或31.您可以尝试

REPLACE(yourField,char(31),'')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM