HTTPCLIENT-1036 StringBody has incorrect default for characterset.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1050239 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2010-12-16 23:59:08 +00:00
parent eb0eab0a86
commit 3a022b2cf9
2 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,9 @@
Changes since 4.1 BETA1
-----------------------
* [HTTPCLIENT-1036] StringBody has incorrect default for characterset. (Default changed to US-ASCII)
Contributed by Sebastian Bazley <sebb at apache.org>
* [HTTPCLIENT-1033] HttpRoute.equals(Object o) is quite inefficient, as it does not take full advantage of shortcut logic
Contributed by Sebastian Bazley <sebb at apache.org>

View File

@ -81,7 +81,7 @@ public class StringBody extends AbstractContentBody {
*
* @param text to be used for the body, not {@code null}
* @param mimeType the mime type, may be {@code null}
* @param charset the character set, may be {@code null}, in which case the hosts default charset is used
* @param charset the character set, may be {@code null}, in which case the US-ASCII charset is used
* @throws UnsupportedEncodingException
* @throws IllegalArgumentException if the {@code text} parameter is null
*/
@ -94,7 +94,7 @@ public class StringBody extends AbstractContentBody {
throw new IllegalArgumentException("Text may not be null");
}
if (charset == null) {
charset = Charset.defaultCharset();
charset = Charset.forName("US-ASCII");
}
this.content = text.getBytes(charset.name());
this.charset = charset;
@ -105,7 +105,7 @@ public class StringBody extends AbstractContentBody {
* The mime type is set to "text/plain".
*
* @param text to be used for the body, not {@code null}
* @param charset the character set, may be {@code null}, in which case the hosts default charset is used
* @param charset the character set, may be {@code null}, in which case the US-ASCII charset is used
* @throws UnsupportedEncodingException
* @throws IllegalArgumentException if the {@code text} parameter is null
*/