mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
fix charset bug
This commit is contained in:
parent
9cec19b779
commit
804a15a105
@ -8,6 +8,7 @@
|
||||
### 新特性
|
||||
* 【core 】 废弃isMactchRegex,改为isMatchRegex(方法错别字)
|
||||
### Bug修复
|
||||
* 【core 】 CharsetUtil在不支持GBK的系统中运行报错问题(issue#731@Github)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -26,7 +26,18 @@ public class CharsetUtil {
|
||||
/** UTF-8 */
|
||||
public static final Charset CHARSET_UTF_8 = StandardCharsets.UTF_8;
|
||||
/** GBK */
|
||||
public static final Charset CHARSET_GBK = Charset.forName(GBK);
|
||||
public static final Charset CHARSET_GBK;
|
||||
|
||||
static{
|
||||
//避免不支持GBK的系统中运行报错 issue#731
|
||||
Charset _CHARSET_GBK = null;
|
||||
try{
|
||||
_CHARSET_GBK = Charset.forName(GBK);
|
||||
} catch (UnsupportedCharsetException e){
|
||||
//ignore
|
||||
}
|
||||
CHARSET_GBK = _CHARSET_GBK;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换为Charset对象
|
||||
|
Loading…
Reference in New Issue
Block a user