Re: org.apache.logging.log4j.core.layout.AbstractStringLayout.getContentType() does not use Charset

2018-03-06 Thread Gary Gregory
On Tue, Mar 6, 2018 at 11:01 PM, Apache wrote: > But I would expect getContentType to return a mime type, not a charset. > A content type can contain a charset parameter, for example: Content-type: text/plain; charset=us-ascii See https://www.w3.org/Protocols/rfc1341/4_Content-Type.html Gary

Re: org.apache.logging.log4j.core.layout.AbstractStringLayout.getContentType() does not use Charset

2018-03-06 Thread Apache
But I would expect getContentType to return a mime type, not a charset. Ralph > On Mar 6, 2018, at 9:17 PM, Gary Gregory wrote: > >> On Tue, Mar 6, 2018 at 6:01 PM, Remko Popma wrote: >> >> Sorry, I don’t follow. >> Why not get the appender’s layout and get the charset by calling >> getCharse

Re: org.apache.logging.log4j.core.layout.AbstractStringLayout.getContentType() does not use Charset

2018-03-06 Thread Gary Gregory
On Tue, Mar 6, 2018 at 6:01 PM, Remko Popma wrote: > Sorry, I don’t follow. > Why not get the appender’s layout and get the charset by calling > getCharset()? > Right now, I have this ugly non-OO code: final Layout layout = appender.getLayout(); final Charset cha

Re: org.apache.logging.log4j.core.layout.AbstractStringLayout.getContentType() does not use Charset

2018-03-06 Thread Remko Popma
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 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 p

Re: org.apache.logging.log4j.core.layout.AbstractStringLayout.getContentType() does not use Charset

2018-03-06 Thread Gary Gregory
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 wrote: > Not all MIME types actually use the encod

Re: org.apache.logging.log4j.core.layout.AbstractStringLayout.getContentType() does not use Charset

2018-03-06 Thread Matt Sicker
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

Re: org.apache.logging.log4j.core.layout.AbstractStringLayout.getContentType() does not use Charset

2018-03-06 Thread Gary Gregory
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 a

Re: org.apache.logging.log4j.core.layout.AbstractStringLayout.getContentType() does not use Charset

2018-03-06 Thread Remko Popma
(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 Ma

org.apache.logging.log4j.core.layout.AbstractStringLayout.getContentType() does not use Charset

2018-03-06 Thread Gary Gregory
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