Return-Path: Delivered-To: apmail-hc-dev-archive@www.apache.org Received: (qmail 53579 invoked from network); 2 Nov 2009 22:49:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Nov 2009 22:49:23 -0000 Received: (qmail 69949 invoked by uid 500); 2 Nov 2009 22:49:23 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 69855 invoked by uid 500); 2 Nov 2009 22:49:22 -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 69845 invoked by uid 99); 2 Nov 2009 22:49:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Nov 2009 22:49:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Nov 2009 22:49:20 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 923D4234C495 for ; Mon, 2 Nov 2009 14:48:59 -0800 (PST) Message-ID: <1522531114.1257202139597.JavaMail.jira@brutus> Date: Mon, 2 Nov 2009 22:48:59 +0000 (UTC) From: "Oleg Kalnichevski (JIRA)" To: dev@hc.apache.org Subject: [jira] Updated: (HTTPCLIENT-884) Charset omitted from UrlEncodedFormEntity Content-Type header In-Reply-To: <1727139646.1257201659410.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HTTPCLIENT-884?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Oleg Kalnichevski updated HTTPCLIENT-884: ----------------------------------------- Priority: Minor (was: Major) Fix Version/s: 4.1 Alpha1 4.0.1 > Charset omitted from UrlEncodedFormEntity Content-Type header > ------------------------------------------------------------- > > Key: HTTPCLIENT-884 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-884 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpClient > Affects Versions: 4.0 Final > Environment: all > Reporter: Jared Jacobs > Priority: Minor > Fix For: 4.0.1, 4.1 Alpha1 > > Original Estimate: 1h > Remaining Estimate: 1h > > UrlEncodedFormEntity sets the Content-Type header to: > "application/x-www-form-urlencoded" > It should set the header to: > "application/x-www-form-urlencoded; charset=" + charset > As a result, content can be misinterpreted by the recipient (e.g. if the entity content includes multibyte Unicode characters encoded with the "UTF-8" charset). > For a correct example of specifying the charset in the Content-Type header, see StringEntity.java. > Here's the fix: > public UrlEncodedFormEntity ( > final List parameters, > final String encoding) throws UnsupportedEncodingException { > super(URLEncodedUtils.format(parameters, encoding), encoding); > - setContentType(URLEncodedUtils.CONTENT_TYPE); > + setContentType(URLEncodedUtils.CONTENT_TYPE + HTTP.CHARSET_PARAM + > + (encoding != null ? encoding : HTTP.DEFAULT_CONTENT_CHARSET)); > } > public UrlEncodedFormEntity ( > final List parameters) throws UnsupportedEncodingException { > - super(URLEncodedUtils.format(parameters, HTTP.DEFAULT_CONTENT_CHARSET), > - HTTP.DEFAULT_CONTENT_CHARSET); > - setContentType(URLEncodedUtils.CONTENT_TYPE); > + this(parameters, HTTP.DEFAULT_CONTENT_CHARSET); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org