Return-Path: Delivered-To: apmail-jakarta-httpclient-dev-archive@www.apache.org Received: (qmail 22885 invoked from network); 24 Feb 2006 14:29:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 Feb 2006 14:29:47 -0000 Received: (qmail 16131 invoked by uid 500); 24 Feb 2006 14:29:46 -0000 Delivered-To: apmail-jakarta-httpclient-dev-archive@jakarta.apache.org Received: (qmail 16118 invoked by uid 500); 24 Feb 2006 14:29:46 -0000 Mailing-List: contact httpclient-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "HttpClient Project" Reply-To: "HttpClient Project" Delivered-To: mailing list httpclient-dev@jakarta.apache.org Received: (qmail 16107 invoked by uid 99); 24 Feb 2006 14:29:46 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Feb 2006 06:29:46 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of mbecke@gmail.com designates 66.249.82.196 as permitted sender) Received: from [66.249.82.196] (HELO xproxy.gmail.com) (66.249.82.196) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Feb 2006 06:29:46 -0800 Received: by xproxy.gmail.com with SMTP id t4so230156wxc for ; Fri, 24 Feb 2006 06:29:25 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=QduSqkHAlSPtBg2qKp61XvFX3DQRaqbcCeS9fvlphaP7Q7ZJFO45d9ph8F/zBySfFwTDLIaThHGMpltPy9Ayu1bssO4LJw2sVJFK30dGNC+AblM5B8s5LykexHor1W8bEHvP+oRsodAx2W4CCMOLzVLK8lcMwydxbCLxz2kRe+o= Received: by 10.70.22.16 with SMTP id 16mr5683783wxv; Fri, 24 Feb 2006 06:29:25 -0800 (PST) Received: by 10.70.51.13 with HTTP; Fri, 24 Feb 2006 06:29:25 -0800 (PST) Message-ID: <78f7873e0602240629x69cecd48s93fbc7befe5009de@mail.gmail.com> Date: Fri, 24 Feb 2006 09:29:25 -0500 From: "Michael Becke" To: "HttpClient Project" Subject: Re: HTTP CLIENT - Question regarding charset setting in MultipartPostMethod In-Reply-To: <27EADFF9923C224FA616F77CA694D1900121AF44@HQ-MAIL4.ptcnet.ptc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <27EADFF9923C224FA616F77CA694D1900121AF44@HQ-MAIL4.ptcnet.ptc.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi Marie-Jo, Sounds like you're referring to the multipart headers, is that correct? Assuming so, you can can control the chartset parameter by using the FilePart object directly. For example try: FilePart f =3D new FilePart(targetFile.getName(), targetFile); f.setChartSet(null); // remove the header or f.setCharSet("\"ISO-8859-1\""); // change the header to "ISO-8859-1" filePost.addPart(f); Also, if you're going to use HttpClient 3.0 I would recommend moving away from the MultipartPostMethod and using the PostMethod with the MultipartRequestEntity instead. Mike On 2/24/06, Plainecassagne, Marie Josephe wrote: > I have 2 solutions that would work with this servlet : > - remove the charset setting in the header > - change the charset setting to =3D"ISO-8859-1" > I don't know how I can make it. Can you help me? > > I have tested versions 2 and versions 3 of HTTPClient. Both of them send > the same header : application/octet-stream; charset=3DISO-8859-1 > > Thanks for your help. > > Best regards > > Marie-Jo Plainecassagne > > PS My code wirh HTTPClient 2.0.2 : > > File targetFile; > String szURL; > > ... > > URL targetURL =3D new URL(szURL); > MultipartPostMethod filePost =3D new MultipartPostMethod(); > filePost.setPath(targetURL.getPath()); > > filePost.addParameter( > targetFile.getName(), > targetFile); > > HttpClient client =3D new HttpClient(); > client.getState().setCredentials( > null, > targetURL.getHost(), > new > UsernamePasswordCredentials(atdmConnection.getUser(), > atdmConnection.getPassword()) > ); > client.startSession(targetURL); > int status =3D client.executeMethod(filePost); > > if (status !=3D 200) { > System.out.println(status + "\n" + > filePost.getResponseBodyAsString()); > throw new Exception("Unable to upload file. Error =3D " + > filePost.getResponseBodyAsString()); > } > > > --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org