// 过滤非法字符、不可识字符
    private static final String THE_FILTERING_CHARACTERS = "[`~*()!@¥$#%&{}+.^:,?�\\[\\]\\\\s+\\\\p{C}\\\\s+\u007F]";

 

// UTF-8:JAVAN寰堝睂ÌÆkѷ㱾拌w��Ꙙ@ 先转码,再去除不可见字符
String metaRdsStrName = new String(metaRdsStringValue.getBytes("ISO_8859-1"), StandardCharsets.UTF_8);
String metaRtStrName = new String(metaRtStringValue.getBytes("ISO_8859-1"), StandardCharsets.UTF_8);
Log.d(TAG, "UTF-8:metaRdsStringValue==" + metaRdsStrName +", metaRtStringValue="+metaRtStrName);
// 去除不可见字符
String replaceAllRds = metaRdsStrName.replaceAll("[+.^:,?�]", "");
String replaceAllRt = metaRtStrName.replaceAll("[+.^:,?�]", "");
Log.d(TAG, "Remove-invisible-characters:RDS=" + replaceAllRds+", RT="+replaceAllRt);

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐