/*** * 微信的昵称中特殊字符的过滤 * ***/ public static String wxNickName(String str) { // TODO Auto-generated method stub String ret = “”; try { byte[] utf8Bytes = str.getBytes(“UTF-8”); ret = new String(utf8Bytes, “UTF-8”); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } Pattern unicodeOutliers = Pattern.compile(“[^\\x00-\\x7F]”, Pattern.UNICODE_CASE | Pattern.CANON_EQ | Pattern.CASE_INSENSITIVE); Matcher unicodeOutlierMatcher = unicodeOutliers.matcher(ret); //System.out.println(“Before: ” + ret); […]
Tags: 微信