Sorry, I don’t follow. Why not get the appender’s layout and get the charset by calling getCharset()?
> On Mar 7, 2018, at 7:21, Gary Gregory <garydgreg...@gmail.com> wrote: > > Here is my current use case: I'd like to be able to query getContentType() > on an FILE appender (File, RollingFile, RAF, ...) and get the proper > charset if the layout for that appender defines it. > > Gary > >> On Tue, Mar 6, 2018 at 3:16 PM, Matt Sicker <boa...@gmail.com> wrote: >> >> Not all MIME types actually use the encoding parameter. For example, >> "application/json;charset=UTF-8" is technically an invalid MIME type (it's >> supposed to be "application/json", and it's assumed to be UTF-8 because >> that's the only official charset for JSON). Providing the charset >> separately makes semantic sense to me. >> >>> On 6 March 2018 at 16:04, Gary Gregory <garydgreg...@gmail.com> wrote: >>> >>> Right. AbstractStringLayout says: >>> >>> @Override >>> public Charset getCharset() { >>> return charset; >>> } >>> >>> /** >>> * @return The default content type for Strings. >>> */ >>> @Override >>> public String getContentType() { >>> return "text/plain"; >>> } >>> >>> Gary >>> >>> >>> >>> On Tue, Mar 6, 2018 at 2:52 PM, Remko Popma <remko.po...@gmail.com> >> wrote: >>> >>>> (Away from pc) by “use”, do you mean that the string returned by >>>> getContentType() doesn’t include a charset? >>>> >>>> From memory, I remember the only place this method is used is in the >>>> HtmlAppender. Are there other places? >>>> >>>> (Shameless plug) Every java main() method deserves http://picocli.info >>>> >>>>> On Mar 7, 2018, at 1:37, Gary Gregory <garydgreg...@gmail.com> >> wrote: >>>>> >>>>> Hi All, >>>>> >>>>> It looks >>>>> like org.apache.logging.log4j.core.layout.AbstractStringLayout. >>>> getContentType() >>>>> does NOT use its charset. >>>>> >>>>> Can anyone foresee a problem with fixing this? >>>>> >>>>> Gary >>>> >>> >> >> >> >> -- >> Matt Sicker <boa...@gmail.com> >>