Checks if the specified encoding is supported. @param encoding encoding @return error message or null
(final String encoding)
| 241 | * @return error message or {@code null} |
| 242 | */ |
| 243 | public static String checkEncoding(final String encoding) { |
| 244 | try { |
| 245 | if(Charset.isSupported(encoding)) return null; |
| 246 | } catch(final IllegalArgumentException ex) { |
| 247 | Util.debug(ex); |
| 248 | } |
| 249 | return "Unknown encoding: " + QueryError.similar(encoding, |
| 250 | Levenshtein.similar(Token.token(encoding), encodings())) + '.'; |
| 251 | } |
| 252 | |
| 253 | /** |
| 254 | * Capitalizes the first letter of a string. |
no test coverage detected