All Projects → dotnet-campus → EncodingNormalior

dotnet-campus / EncodingNormalior

Licence: MIT license
规范化文件编码。Make the file's encoding standard.

Programming Languages

C#
18002 projects
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to EncodingNormalior

Ifme
Powerful x265 GUI Encoder
Stars: ✭ 168 (+189.66%)
Mutual labels:  encoding
Encoding rs
A Gecko-oriented implementation of the Encoding Standard in Rust
Stars: ✭ 196 (+237.93%)
Mutual labels:  encoding
Armor
Armor is a simple Bash script designed to create encrypted macOS payloads capable of evading antivirus scanners.
Stars: ✭ 228 (+293.1%)
Mutual labels:  encoding
Packetserial
An Arduino Library that facilitates packet-based serial communication using COBS or SLIP encoding.
Stars: ✭ 177 (+205.17%)
Mutual labels:  encoding
Base X
Encode/decode any base
Stars: ✭ 191 (+229.31%)
Mutual labels:  encoding
Elixir Json
Native JSON library for Elixir
Stars: ✭ 216 (+272.41%)
Mutual labels:  encoding
Mini Svg Data Uri
Small, efficient encoding of SVG data URIs for CSS, HTML, etc.
Stars: ✭ 158 (+172.41%)
Mutual labels:  encoding
RCNB.js
Everything can be encoded into RCNB with JavaScript.
Stars: ✭ 50 (-13.79%)
Mutual labels:  encoding
Rust Lexical
Lexical, to- and from-string conversion routines.
Stars: ✭ 192 (+231.03%)
Mutual labels:  encoding
Qs
Quick serialization of R objects
Stars: ✭ 225 (+287.93%)
Mutual labels:  encoding
Encoding
Encoding Standard
Stars: ✭ 176 (+203.45%)
Mutual labels:  encoding
Convertzz
繼承自convertz,但更好用的簡繁轉換工具
Stars: ✭ 181 (+212.07%)
Mutual labels:  encoding
Go
decode/encode thrift message without IDL
Stars: ✭ 219 (+277.59%)
Mutual labels:  encoding
Go.geojson
Encoding and decoding GeoJSON <-> Go
Stars: ✭ 172 (+196.55%)
Mutual labels:  encoding
Iconv Lite
Convert character encodings in pure javascript.
Stars: ✭ 2,697 (+4550%)
Mutual labels:  encoding
Xssor2
XSS'OR - Hack with JavaScript.
Stars: ✭ 1,969 (+3294.83%)
Mutual labels:  encoding
Jsonlab
JSONLab: a native JSON/UBJSON/MassagePack encoder/decoder for MATLAB/Octave
Stars: ✭ 202 (+248.28%)
Mutual labels:  encoding
D365FONinjaDevTools
To make of you a Ninja Developer in Dynamics 365 For Finance and Operations
Stars: ✭ 70 (+20.69%)
Mutual labels:  visual-studio-extension
dotnet-file
Download, update and sync loose files from URLs
Stars: ✭ 42 (-27.59%)
Mutual labels:  dotnet-tool
Stego
🦕 stego is a steganographic swiss army knife.
Stars: ✭ 220 (+279.31%)
Mutual labels:  encoding

编码检测和修改工具

Appveyor Build GitHub Action
Build status
Package Name Release (NuGet)
dotnetCampus.EncodingNormalior NuGet
lindexi.src.EncodingUtf8AndGBKDifferentiater NuGet

在开发中经常遇到编码不一致的文件,而如果这些文件包含需要显示的字符串,就会导致在乱码。所以需要一个工具可以自动检测工程、文件夹内所有文本的编码,并可以规范所有文件编码。

工具要求可以设置规定的编码,如果文件的编码不是规定的编码,用户可以选择把文件的编码转换为规定的编码。

用户可以设置白名单,白名单可以让某些文件或文件夹的文件不检测。

默认是检测所有的文本文件,但是因为没有一个好的算法,所以在无法判断一个文件是文本时,会去查看用户是不是设置了一定包含某个文件后缀,一旦文件在用户的包含后缀中,那么就会去检测文件编码。

程序首先是检查文件是否在白名单,如果不在,再检测是否包含文件后缀,如果没有,再检测文件是否是文本,如果是的话,就检查。

首先是告诉大家如何使用工具。

工具的使用

命令行使用

命令行使用参见:编码工具——命令行

插件使用

首先是下载插件,插件可以到 https://visualstudiogallery.msdn.microsoft.com/a5f50c64-1b75-4f7a-97fd-9545747c506a 下载,也可以在 VS 插件网 搜索 Encoding 就可以找到我的工具啦。可以说我翻遍了整个插件网,都没有找到我这个功能的插件(这句话是在2017年说的),但是还是找到了一些有用的插件。

打开 Visual Sutido ,在安装完 编码规范工具 ,可以看到菜单多了 选项 EncodingNormalizer

然后来说下我做的功能。

修改当前文件编码

在 2.6 版本新添加的功能是修改当前打开的文件的编码,即使这个文件不在当前的项目里面

因为现在没有一个方法可以知道一个文件是什么编码,所以可以在插件自己手动选当前文件的编码,这样可以解决识别编码错误

选择当前的文件的编码,和需要转换的文件的编码,然后点击 Convert 就可以转换了

现在能支持的转换的编码是带符号的 Utf-8 和 GBK 编码

设置

点击菜单 EncodingNormailzer ,选择 Setting 可以看到下面界面

首先是可以忽略一些文件或文件夹,默认是忽略一些不是文本的文件和 bin、obj、git文件夹,注意,千万不要去转换 git 文件夹的代码。

然后我们可以设置编码,现在做的是 Utf8 、GBK、Unicode的编码,如果检测工程存在文件的编码和我们设置的不一样,就会提示去转换。

因为 Ascii 的文件,存放为 GBK 和 UTF8不带签名是无法区分的,所以忽略 ASCII 编码文件。

因为对 Unicode-16 的文件是无法使用判断存在 '\0' 来区分文件是不是文本,所以,对于某些文件还是自己手动添加是否一定检测,对于没有被添加到一定需要检测的文件,先判断他是不是文本,如果是的话,就检测。

设置保存在 我的文档\EncodingNormalizer\Account.json 文件

检查编码

然后在打开完工程,注意要加载完成才使用。

点击 Conform solution encoding ,自动检测方案所有工程的文件编码,如果发现所有的编码都符合规范,那么弹出窗口说所有文件都符合规范。如果有文件不符合规范,那么提示用户是否转换。

找到所有不符合规范的文件,可以一键点击转换

和我组队做工具

这个工具相信是大家比较需要的,所以我就做了这个工具。做这个工具最难的地方在于判断文件编码,和如何做vs扩展两个。如果大家也想做一个差不多的东西,可以参见开发过程中使用的技术:C# 判断文件编码 VisualStudio 扩展开发

我把工具放在 github : https://github.com/dotnet-campus/EncodingNormalior

好像我的项目名称 编码规范工具 是 EncodingNormalizer ,写错了,但是不想改。

我还把他放在 vs 扩展库,可以到 https://marketplace.visualstudio.com/ 下载。

来说下如何使用我的项目:

我的项目有类库 EncodingNormalior 和插件 EncodingNormalizerVsx。

如果想运行类库,不需要做任何修改。如果想运行插件,需要修改属性->调试,使用外部程序,里面写C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe 我现在是 VisualStudio 2015 所以是在Visual Studio 14.0

然后修改命令行参数:/rootsuffix Exp

然后就可以运行。

如果希望开发这个项目,可以去fork我的github库。

如果现在使用的是 visualStudio 2017 企业版,那么把外部程序修改为C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.exe

现在使用 VisualStudio 2019 社区版,将外部程序修改为 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].