本文介绍了<0xEF,0xBB,0xBF>出现在文件中的字符.如何删除它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在压缩 JavaScript 文件,但压缩器抱怨我的文件中有  字符.

I am doing compressing of JavaScript files and the compressor is complaining that my files have  character in them.

如何搜索这些字符并将其删除?

How can I search for these characters and remove them?

推荐答案

perl -pi~ -CSD -e 's/^x{fffe}//' file1.js path/to/file2.js

如果您的文件中有其他 utf-8,我认为该工具会损坏,但如果没有,也许此解决方法可以帮助您.(未经测试...)

I would assume the tool will break if you have other utf-8 in your files, but if not, perhaps this workaround can help you. (Untested ...)

编辑:根据 tchrist 的评论添加了 -CSD 选项.

Edit: added the -CSD option, as per tchrist's comment.

这篇关于<0xEF,0xBB,0xBF>出现在文件中的字符.如何删除它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 02:43