JVM 的默认编码是什么? [英] What is the default encoding of the JVM?

查看:33
本文介绍了JVM 的默认编码是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UTF-8 是 Java 中的默认编码吗?
如果没有,我怎么知道默认使用的是哪种编码?

Is UTF-8 the default encoding in Java?
If not, how can I know which encoding is used by default?

推荐答案

JVM 的默认字符集是运行它的系统的字符集.对此没有特定值,您通常不应依赖默认编码为任何特定值.

The default character set of the JVM is that of the system it's running on. There's no specific value for this and you shouldn't generally depend on the default encoding being any particular value.

它可以在运行时通过 Charset.defaultCharset() 访问,如果这对你有用的话,但实际上你应该指出总是明确指定编码你可以这样做.

It can be accessed at runtime via Charset.defaultCharset(), if that's any use to you, though really you should make a point of always specifying encoding explicitly when you can do so.

这篇关于JVM 的默认编码是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆