Return-Path: X-Original-To: apmail-hc-dev-archive@www.apache.org Delivered-To: apmail-hc-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9F974D53D for ; Thu, 15 Nov 2012 18:50:12 +0000 (UTC) Received: (qmail 83889 invoked by uid 500); 15 Nov 2012 18:50:12 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 83851 invoked by uid 500); 15 Nov 2012 18:50:12 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 83840 invoked by uid 99); 15 Nov 2012 18:50:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Nov 2012 18:50:12 +0000 Date: Thu, 15 Nov 2012 18:50:12 +0000 (UTC) From: "Gary Gregory (JIRA)" To: dev@hc.apache.org Message-ID: <450747886.120341.1353005412362.JavaMail.jiratomcat@arcas> In-Reply-To: <1973136376.119202.1352988252318.JavaMail.jiratomcat@arcas> Subject: [jira] [Commented] (HTTPCLIENT-1260) Javadoc incorrectly states StringBody(String)'s encoding uses the system default. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HTTPCLIENT-1260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13498233#comment-13498233 ] Gary Gregory commented on HTTPCLIENT-1260: ------------------------------------------ Thank you for the bug report. Fixed in trunk: commit -m "[HTTPCLIENT-1260] Javadoc incorrectly states StringBody(String)'s encoding uses the system default. Contributed by Tim and Gary Gregory " C:/svn/org/apache/httpcomponents/trunk/httpclient/httpmime/src/main/java/org/apache/http/entity/mime/content/StringBody.java C:/svn/org/apache/httpcomponents/trunk/httpclient/RELEASE_NOTES.txt Sending C:/svn/org/apache/httpcomponents/trunk/httpclient/RELEASE_NOTES.txt Sending C:/svn/org/apache/httpcomponents/trunk/httpclient/httpmime/src/main/java/org/apache/http/entity/mime/content/StringBody.java Transmitting file data ... Committed revision 1409922. > Javadoc incorrectly states StringBody(String)'s encoding uses the system default. > --------------------------------------------------------------------------------- > > Key: HTTPCLIENT-1260 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1260 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpClient > Affects Versions: 4.2.2 > Environment: Android > Reporter: Tim > Priority: Minor > Labels: documentation, newbie > Original Estimate: 5m > Remaining Estimate: 5m > > (Sorry if this is the wrong component.) > In the class `org.apache.http.entity.mime.content.StringBody`, there is the following code: > /** > * Create a StringBody from the specified text. > * The mime type is set to "text/plain". > * The hosts default charset is used. > * > * @param text to be used for the body, not {@code null} > * @throws UnsupportedEncodingException > * @throws IllegalArgumentException if the {@code text} parameter is null > */ > public StringBody(final String text) throws UnsupportedEncodingException { > this(text, "text/plain", null); > } > Note that it says "The hosts [sic] default charset is used.". This is incorrect. The code *always* uses US-ASCII no matter what the host's default charset is (e.g. on Android it is UTF-8). > Quite annoying! It should read: > /** > * Create a StringBody from the specified text. > * The mime type is set to "text/plain". > * The charset is set to US-ASCII. > * > * @param text to be used for the body, not {@code null} > * @throws UnsupportedEncodingException > * @throws IllegalArgumentException if the {@code text} parameter is null > */ > public StringBody(final String text) throws UnsupportedEncodingException { > this(text, "text/plain", null); > } > I'd appreciate it if you could fix this, so future developers won't have the frustration of working out why their non-ascii characters are all being changed to question marks. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org