搜索非ascii文档 [英] search document for non-ascii

查看:120
本文介绍了搜索非ascii文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的电脑上的应用程式需要读取文字档案。我有几个,一个不工作;程序无法读取它,并告诉我有一个坏的字符在某处。我的第一个猜测是有一个非ascii字符在某处,但我不知道如何找到它。 Perl或任何一般的正则表达式都会很好。任何想法?

An application on my computer needs to read in a text file. I have several, and one doesn't work; the program fails to read it and tells me that there is a bad character in it somewhere. My first guess is that there's a non-ascii character in there somewhere, but I have no idea how to find it. Perl or any generic regex would be nice. Any ideas?

推荐答案

您可以使用 [^ \x20 -\x7E] 匹配非ASCII字符。

You can use [^\x20-\x7E] to match a non-ASCII character.

例如 grep -P'[^ \x20 -\x7E]'suspicious_file

这篇关于搜索非ascii文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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