<pre name="code" class="java">package com.test.util;
import java.nio.charset.Charset;
public class getDefaultCharset
{
public static void main(String[] args)
{
//获取系统默认编码
System.out.println(System.getProperty("file.encoding"));
//获取系统默认的字符编码
System.out.println(Charset.defaultCharset());
//获取系统默认语言
System.out.println(System.getProperty("user.language"));
//获取系统属性列表
System.getProperties().list(System.out);
//设置编码
System.getProperties().put("file.encoding", "GBK");
}
}
java 获取系统中默认的编码
最新推荐文章于 2024-05-21 23:43:50 发布