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

🐛[BUG] hosts文件中含GB2312编码字符时有乱码问题 #362

Closed
Nepartak opened this issue Aug 11, 2021 · 2 comments
Closed

🐛[BUG] hosts文件中含GB2312编码字符时有乱码问题 #362

Nepartak opened this issue Aug 11, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@Nepartak
Copy link

🐛 描述(Description)

我的hosts文件内原本含有一些其他应用生成的GB2312编码的中文注释,使用Steam++的一键加速功能后hosts文件会出现锟斤拷乱码。只是一个小问题,也没有带来实质困扰,维持现状也没什么影响,但如果能相应优化一下就更好了。

🚑 基本信息(Basic Information)

  • 程序版本(Program Version):2.3.0
  • 系统版本号(OS Version): Windows 10.19043.1165
@Nepartak Nepartak added the bug Something isn't working label Aug 11, 2021
@AigioL
Copy link
Member

AigioL commented Aug 11, 2021

保存文件使用的 File.WriteAllText 没有指定编码,应该是使用的 Encoding.Default
这个在 .net 6 上应该是 utf-8 无 bom
https://github.com/SteamTools-Team/SteamTools/blob/develop/src/ST.Client.Desktop/Services/Implementation/HostsFileServiceImpl.cs#L448

没什么好办法判断文件之前是什么编码的,要能判断文件编码才能改成调用 WriteAllText(String, String, Encoding)

@Nepartak
Copy link
Author

我使用另一款应用的频率很低,所以我手动转一下编码就好了。谢谢回复。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants