Guest User

Untitled

a guest
Jan 24th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1.     @Override
  2.     public void onMessage(String channel, String sender, String login, String hostname, String message, Dasik bot) {
  3.         Charset charset = Charset.forName("UTF-8");
  4.         CharsetDecoder decoder = charset.newDecoder();
  5.         decoder = decoder.onUnmappableCharacter(CodingErrorAction.REPORT);
  6.         decoder = decoder.onMalformedInput(CodingErrorAction.REPORT);
  7.  
  8.         try {
  9.             decoder.decode(ByteBuffer.wrap(message.getBytes()));
  10.         } catch (CharacterCodingException ex) {
  11.             bot.send(channel, "Error detected!");
  12.         }
  13.         log.debug("Encoding OK");
  14.     }
Add Comment
Please, Sign In to add comment