更新时间:2023-02-17 19:33:29
一些注释:
-Dfile.encoding = utf8
是不支持并可能导致意外的副作用:-Dfile.encoding=utf8
is not supported and may cause unintended side-effects:J2SE平台规范不要求file.encoding属性;它是Sun实现的内部细节,不应由用户代码检查或修改。它也是只读的;在技术上不可能支持在命令行或程序执行期间的任何其他时间将此属性设置为任意值。
The "file.encoding" property is not required by the J2SE platform specification; it's an internal detail of Sun's implementations and should not be examined or modified by user code. It's also intended to be read-only; it's technically impossible to support the setting of this property to arbitrary values on the command line or at any other time during program execution.
控制台
类将检测并使用终端编码,但不支持65001 Windows上的(UTF-8) - 至少,它不是我最后一次尝试它我认为是正确的,记录使用Unicode与cmd.exe的方法是使用 WriteConsoleW
和 ReadConsoleW
。
I believe that the correct, documented way to use Unicode with cmd.exe is to use WriteConsoleW
and ReadConsoleW
.
我在看这篇文章时写了几篇博文:
I wrote a couple of blog posts when I was looking at this: