code: @Nonnull
    public static String ensureEncodingName(@Nullable final String charsetName) {
      final Charset defaultCharset = Charset.defaultCharset();
      try {
        return (charsetName == null) ? defaultCharset.name() : Charset.forName(charsetName.trim()).name();
      } catch (IllegalCharsetNameException ex) {
        throw new IllegalArgumentException("Can't recognize charset for name '" + charsetName + '\'');
      }
    }
docs: Get charset name. If name is null then default charset name provided.
  
  @param charsetName name of charset, can be null
  @return charset name, must not be null
  @throws IllegalArgumentException if charset name can't be recognized