问题
What's the command to set the JVM's character set?
(Also, what's the command to view the current JVM's character set, so I know how to reset it back to default after I'm done)
Thanks,
回答1:
java strings are always utf-16 internally (javadoc link), but you can use -Dfile.encoding=UTF-8 to facilitate reading files with a default charset.
Just ensure java has access to that fileset when you set it or it won't start.
回答2:
java.nio.charset.Charset.defaultCharset() Will get you the JVM's default charset.
来源:https://stackoverflow.com/questions/10890578/how-to-set-the-jvm-charset-on-the-command-line