Java examples for Internationalization:Charset
check For Non Ascii Chars
//package com.java2s; import java.util.List; public class Main { public static void main(String[] argv) throws Exception { String resourceName = "java2s.com"; List strs = java.util.Arrays.asList("asdf", "java2s.com"); System.out.println(checkForNonAsciiChars(resourceName, strs)); }/*from w ww . j a v a 2 s. c om*/ /** * @param resourceName * @param strs * @return true if the {@code strs} contained non-ASCII characters, false if all characters were ASCII */ public static final boolean checkForNonAsciiChars(String resourceName, List<String> strs) { boolean res = false; for (String str : strs) { for (int i = 0, size = str.length(); i < size; i++) { if (str.charAt(i) > 127) { System.err.println(resourceName + ": " + i + "'" + str.charAt(i) + "' " + str.substring(Math.max(0, i - 10), Math.min(str.length(), i + 10))); res = true; } } } return res; } }