在 Windows 中识别 unicode 编码的文本文件的最佳方法是什么? [英] What's the best way to identify unicode encoded text files in Windows?

查看:56
本文介绍了在 Windows 中识别 unicode 编码的文本文件的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个代码库,由于多个团队成员使用不同的编辑器(和默认设置)进行开发,因此其中散布着一些 unicode 编码文件.我想通过查找所有 unicode 编码文件并将它们转换回 ANSI 编码来清理我们的代码库.

I am working on a codebase which has some unicode encoded files scattered throughout as a result of multiple team members developing with different editors (and default settings). I would like to clean up our code base by finding all the unicode encoded files and converting them back to ANSI encoding.

对于如何完成此任务的查找"部分的任何想法,我们将不胜感激.

Any thoughts on how to accomplish the "finding" part of this task would be truly appreciated.

推荐答案

参见 “如何检测文本文件的字符编码?”“如何可靠地猜测编码[...]?”

  • 可以通过验证检测到 UTF-8.您还可以查找 BOM EF BB BF,但不要依赖它.
  • 可以通过查找 BOM 来检测 UTF-16.
  • UTF-32 可以通过验证或 BOM 检测.
  • 否则采用 ANSI 代码页.

我们的代码库不包含任何非 ASCII 字符.我会尝试grep对于我们代码库中文件中的 BOM.感谢您的澄清.

Our codebase doesn't include any non-ASCII chars. I will try to grep for the BOM in files in our codebase. Thanks for the clarification.

好吧,这让事情变得很多更简单.没有非 ASCII 字符的 UTF-8 ASCII.

Well that makes things a lot simpler. UTF-8 without non-ASCII chars is ASCII.

这篇关于在 Windows 中识别 unicode 编码的文本文件的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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