-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
bat文件,修改编码格式, 经常无法生效 #394
Comments
By default 7-bit ASCII is opened in UTF-8 mode, to enforce it's been opened in UTF-8 mode, you can put some Chinese charterers (e.g. comments) after reload the file as ANSI encoding ( Possible we should prefer (or always use) ANSI encoding for Batch files, as we already use OEM (DOS-437) for ANSI Art files. |
utf-8是变长字符集,在英文字符集的编码范围和ansi英文编码是一样的。所以只有英文的情况,他们一样。如果担心以后加入中文编码不一致,可以用utf-8带签名(BOM)的版本。 |
感谢回复, |
感谢回复, 我的意思是说, 能不能搞简单点, 如果bat原编码是ansi的, 修改后,保存就还是ansi的, 不要再去重载, 或更改,
上手一用,改个批处理, 保存后就不运行了, 的确让人有点纠心 , 用别的记事本软件, 真没用到过这个问题,
|
不知道如何针对某个扩展名设置编码,但是可以设置“全局的”默认编码格式,在菜单“文件” - “编码” - “默认”。有些复选框你可以看看。 我想作者默认用 utf-8 ,是为了兼容 Linux 系统。 |
赞同楼主! 楼主可以通过楼上介绍的方式取消默认打开为UTF8,也可以手工添加这样两行到配置文件Notepad2.ini: |
Similar bug has been reported before. Will add a option to load 7-bit Batch file in ANSI encoding. |
那么可以在自定义语法高亮里面,增加功能指定文件类型的编码吗? |
That requires large amount of work: currently file type (and line endings, indentation settings) is identified after encoding detection. |
看来真是隔行如隔山,我不懂编程细节。我以为是先读取文件名和后缀,然后根据后缀分配语法高亮,实际是恰恰相反的。 |
以前也用过 notepad2 修改bat文件, 当时就感觉奇怪. 修改之后就不能运行了, 后来同事提醒, 让看一下是不是ansi编码格式, 硬实在保存后,成了utf-8格式, 改回ansi之后就能运行了
最近, 修改bat文件有些频繁, 再次注意到了这个编码的问题, 情况如下:
没有找到相关的设置, 请求开发人员验证一下问题, 非常感谢
示
The text was updated successfully, but these errors were encountered: