Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request]打开空txt是否可以当做默认写入而非默认读取(或者默认utf-8)? #1319

Open
RedBagel opened this issue Mar 1, 2024 · 3 comments

Comments

@RedBagel
Copy link

RedBagel commented Mar 1, 2024

Is your feature request related to a problem? Please describe.
创建一个空的新建txt在资源管理器中,再使用notepads打开,不论默认写入设置的是什么编码,总会是utf8编码。仅有从notepads自带的“+”创建会符合默认写入编码设置。

Describe the solution you'd like
空txt打开也符合默认写入编码设置。

Describe alternatives you've considered

Additional context
默认写入设置和默认读取设置:
image
创建一个空的新建txt在资源管理器中,再使用notepads打开:
image
从notepads自带的“+”创建:
image

P.S.有点好奇为什么默认写入和读取的选择只有小部分常用格式而非全部?是因为极简的理念还是没必要,又或者是担心使用者选错导致问题的产生,抑或都有?

😊🌹❤️

@0x7c13
Copy link
Owner

0x7c13 commented Mar 17, 2024

你改成-BOM编码之后要是保存了再打开就是会识别到-BOM编码 (BOM是有header的,非BOM的比如UTF8是没有header的),问题是你没保存。
你要是用任意一个软件使用非BOM编码保存空白txt那怎么可能会现实带BOM呢

@Harriser
Copy link

系统优先级是高于软件行为的,所以你在其他位置新建文件时,并不会按照你在软件内的预设值去创建

参考下这个,应该能解决你的问题
https://blog.csdn.net/so_geili/article/details/77816619

@RedBagel
Copy link
Author

RedBagel commented May 1, 2024

非常抱歉这么迟才回复
 
 

系统优先级是高于软件行为的,所以你在其他位置新建文件时,并不会按照你在软件内的预设值去创建

参考下这个,应该能解决你的问题 https://blog.csdn.net/so_geili/article/details/77816619

感谢你提供的方法!

 
 

你改成-BOM编码之后要是保存了再打开就是会识别到-BOM编码 (BOM是有header的,非BOM的比如UTF8是没有header的),问题是你没保存。 你要是用任意一个软件使用非BOM编码保存空白txt那怎么可能会现实带BOM呢

我的意思是,从“文件资源管理器”中新建txt的时候自带bom这个header。当然,这可能就不算空txt了(好像占用了3字节),尽管里面没有内容。

https://blog.csdn.net/so_geili/article/details/77816619

即Harriser发的这个链接这种。

实现方式也是那链接文章的逻辑:“新建是复制C:\WINDOWS\SHELLNEW中的对应文件”,即使用一个bom-utf8的空txt(内容空)替换掉该文件夹中的对应txt文件。

但是我不知道为什么替换之后失败了。可能win10没有那个功能,之后如果有时间准备试试win11。

如果要用软件实现,可能需要软件增加一个右键的新建列表,就像新建word或者excel一样1

Footnotes

  1. 这是office的用于新建的文件夹:image
    不过不知道为什么部分没有(红块那几个):
    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants