隐形角色抬头? (PHP)
我正在解析一些包含不可见字符的文件。这些文件的结构很奇怪,因此有时我必须在 9 或 10 个不可见字符之后才能找到真正的信息。是的...
无论如何,我有一些文件似乎包含我的正则表达式还不知道的不可见字符。有没有某种方法可以通过函数传递字符来查找其字符代码?因为它是看不见的,所以我真的没有什么可继续的,哈哈。
目前我正在使用以下正则表达式来查找不可见字符。 (从这个问题找到)
public $invisibles='\x00-\x09\x0B\x0C\x0E-\x1F\x7F';
I'm parsing some files that contain invisible characters. The files are structured strangely so that I sometimes have to find real information after 9 or 10 invisible characters. Yeah...
Anyway, I have some files that seem to have invisible characters that my regex doesn't yet know about. Is there some way to pass a character through a function to look up it's character code? Since it's invisible, I don't really have much else to go on, ha.
Currently I'm using the following regular expression to find invisible characters. (found from this question)
public $invisibles='\x00-\x09\x0B\x0C\x0E-\x1F\x7F';
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的是控制角色。但另一个真正的不可见字符是
\xA0
不间断空格。无论如何,要找出困扰您的问题,请首先将其隔离(
substr
如果可以的话) ,然后通过ord()
来获取 ASCII 数字:(dechex 是将其打印为十六进制)
不过实际上,您应该下载一个用于此类目的的十六进制编辑器。
Yours are control characters. But another real invisible character is
\xA0
the non-breaking space.Anyway to find out which is bugging you, first isolate it (
substr
if you can), and then pass it throughord()
to get the ASCII number:(dechex is for printing it out as hex)
Though really, you should just download a hexeditor for such purposes.