Time:10-08
CodePudding user response:
modify the code format, not necessarily with the default encoding format
.net Core the default attribute In the.net Core Default attribute always return UTF8Encoding , and all operating systems (Windows, Linux, and maximum OS X) running on the. NET Core application support utf-8,
Var reader=new StreamReader (fs, Encoding GetEncoding (" gb2312 ")) .
this is because the Net more for Linux Core, MacOX system, such as Microsoft document written like this: reference .net Core the default attribute In the.net Core Default attribute always return UTF8Encoding , and all operating systems (Windows, Linux, and maximum OS X) running on the. NET Core application support utf-8, https://docs.microsoft.com/zh-cn/dotnet/api/system.text.encoding.default? View=netframework 4.8 You can detect Chinese Windows system in the code, and set Encoding for Encoding. GetEncoding (such as "gb2312") Var reader=new StreamReader (fs, Encoding GetEncoding (" gb2312 ")) .
Quote: refer to the second floor jx315425246 response: modify the code format, not necessarily with the default encoding format Coding I replace all right, can't oh
Quote: refer to the 11 floor Demons1874 response: It should be alright with my environment, I change the SDK
Quote: refer to 12 floor dreamer NO1 reply: Quote: refer to the 11 floor Demons1874 response: It should be alright with my environment, I change the SDK I think I know what's the problem, should be Windows notepad, you try to use other editor to create a file, such as notepad + +, or D:/log. TXT file save as to select encoding format for UTF8, save and then try to read
Page link:https//www.codepudding.com/net/57051.html