You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by se...@apache.org on 2010/12/17 00:59:08 UTC

svn commit: r1050239 - in /httpcomponents/httpclient/trunk: RELEASE_NOTES.txt httpmime/src/main/java/org/apache/http/entity/mime/content/StringBody.java

Author: sebb
Date: Thu Dec 16 23:59:08 2010
New Revision: 1050239

URL: http://svn.apache.org/viewvc?rev=1050239&view=rev
Log:
HTTPCLIENT-1036 StringBody has incorrect default for characterset.

Modified:
    httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
    httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/content/StringBody.java

Modified: httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt?rev=1050239&r1=1050238&r2=1050239&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient/trunk/RELEASE_NOTES.txt Thu Dec 16 23:59:08 2010
@@ -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>
 

Modified: httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/content/StringBody.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/content/StringBody.java?rev=1050239&r1=1050238&r2=1050239&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/content/StringBody.java (original)
+++ httpcomponents/httpclient/trunk/httpmime/src/main/java/org/apache/http/entity/mime/content/StringBody.java Thu Dec 16 23:59:08 2010
@@ -81,7 +81,7 @@ public class StringBody extends Abstract
      * 
      * @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 Abstract
             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 Abstract
      * 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
      */