org.yelong.support.properties.PropertiesUTF8 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yelong-support Show documentation
Show all versions of yelong-support Show documentation
对各种开源框架的包装、支持、拓展。这里也包含的yelong-core与orm框架的整合。
默认对所有依赖为 scope 为 provided 。您需要针对自己的需要进行再次依赖
/**
*
*/
package org.yelong.support.properties;
import java.io.UnsupportedEncodingException;
import java.util.Properties;
/**
* 重写获取proeprty方法。获取的所有值将进行转换为utf-8格式
*
* @author PengFei
*/
public class PropertiesUTF8 extends Properties{
private static final long serialVersionUID = -3925335530308637498L;
private static final String ENCODING = "UTF-8";
@Override
public String getProperty(String key) {
String value = super.getProperty(key);
if( null == value ) {
return null;
}
try {
return new String(value.getBytes("ISO-8859-1"),ENCODING);
} catch (UnsupportedEncodingException e) {
return null;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy