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 4208617B5B for ; Mon, 12 Jan 2015 06:27:33 +0000 (UTC) Received: (qmail 75640 invoked by uid 500); 12 Jan 2015 06:27:34 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 75598 invoked by uid 500); 12 Jan 2015 06:27:34 -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 75587 invoked by uid 99); 12 Jan 2015 06:27:34 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jan 2015 06:27:34 +0000 Date: Mon, 12 Jan 2015 06:27:34 +0000 (UTC) From: "MaiZhang (JIRA)" To: dev@hc.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HTTPCLIENT-1594) MultipartEntity doesn't work when I set Charset for it 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-1594?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14273249#comment-14273249 ] MaiZhang commented on HTTPCLIENT-1594: -------------------------------------- By the way,at this line: mult.setCharset(Charset.forName("UTF-8")); if I change it to:mult.setCharset(Charset.forName("USASCII")); the server can't receive any data too. > MultipartEntity doesn't work when I set Charset for it > ------------------------------------------------------ > > Key: HTTPCLIENT-1594 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1594 > Project: HttpComponents HttpClient > Issue Type: Bug > Components: HttpMime > Affects Versions: 4.2.6 > Environment: Client info: Android,Sumsung note3 > Server info: php server > Reporter: MaiZhang > Labels: features > > I need upload files to my server,but the file name maybe Chinese.So I want to set charset to MultipartEntity,cuz its default charset is US-ASCII,the file name be sended to server looks like "?????.txt" eg. .But, when I set UTF-8 to it,the server can't get any data. > MultipartEntity mult = new MultipartEntity(); > mult.addPart("k", new StringBody(getAccessToken().getAccessToken())); > mult.addPart("attfile", new FileBody(new File(entity.getFilePath()))); > This code works well,but:::::: > MultipartEntity mult = new MultipartEntity(null,null,Charset.forName("UTF-8")); > mult.addPart("k", new StringBody(getAccessToken().getAccessToken())); > mult.addPart("attfile", new FileBody(new File(entity.getFilePath()))); > can't post data to server,it's too strange!!! > AND!!!!!!! > if I use > MultipartEntity mult = new MultipartEntity(); > this way and set breakpoint at the second line,and change the value of multipart-charset-canonicalName to "UTF-8",the server will get the right file name,I think if I set charset to a MultipartEntity object,it will not work. > And, I tested httpmime4.3.x,by MultipartEntityBuilder,it doesn't work too. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org