diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/ContentType.java b/httpcore5/src/main/java/org/apache/hc/core5/http/ContentType.java index 9ce5121bb..ebee29731 100644 --- a/httpcore5/src/main/java/org/apache/hc/core5/http/ContentType.java +++ b/httpcore5/src/main/java/org/apache/hc/core5/http/ContentType.java @@ -184,7 +184,7 @@ public final class ContentType implements Serializable { "text/markdown", StandardCharsets.UTF_8, false); public static final ContentType TEXT_PLAIN = create( - "text/plain", StandardCharsets.UTF_8, true); + "text/plain", StandardCharsets.UTF_8, false); public static final ContentType TEXT_XML = create( "text/xml", StandardCharsets.UTF_8, false); /** @@ -432,9 +432,7 @@ public static ContentType create(final String mimeType, final Charset charset) { * @param mimeType MIME type. It may not be {@code null} or empty. It may not contain * characters {@code <">, <;>, <,>} reserved by the HTTP specification. * @return content type - * @deprecated Use {@link #create(String, Charset, boolean)} with an explicit charset or null, and specify if the charset is implicit. */ - @Deprecated public static ContentType create(final String mimeType) { return create(mimeType, (Charset) null); } diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestStringEntity.java b/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestStringEntity.java index 0b9cfa353..f6e370a91 100644 --- a/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestStringEntity.java +++ b/httpcore5/src/test/java/org/apache/hc/core5/http/io/entity/TestStringEntity.java @@ -66,7 +66,7 @@ void testDefaultContent() throws Exception { httpentity = new StringEntity(s, StandardCharsets.US_ASCII); Assertions.assertEquals("text/plain; charset=US-ASCII", httpentity.getContentType()); httpentity = new StringEntity(s); - Assertions.assertEquals("text/plain", httpentity.getContentType()); + Assertions.assertEquals("text/plain; charset=UTF-8", httpentity.getContentType()); } private static String constructString(final int [] unicodeChars) {