Return-Path: X-Original-To: apmail-james-mime4j-dev-archive@minotaur.apache.org Delivered-To: apmail-james-mime4j-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3CB517102 for ; Mon, 19 Dec 2011 10:22:32 +0000 (UTC) Received: (qmail 51893 invoked by uid 500); 19 Dec 2011 10:22:31 -0000 Delivered-To: apmail-james-mime4j-dev-archive@james.apache.org Received: (qmail 51843 invoked by uid 500); 19 Dec 2011 10:22:30 -0000 Mailing-List: contact mime4j-dev-help@james.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: mime4j-dev@james.apache.org Delivered-To: mailing list mime4j-dev@james.apache.org Received: (qmail 51835 invoked by uid 99); 19 Dec 2011 10:22:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Dec 2011 10:22:29 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lukas.vlcek@gmail.com designates 209.85.213.49 as permitted sender) Received: from [209.85.213.49] (HELO mail-yw0-f49.google.com) (209.85.213.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Dec 2011 10:22:22 +0000 Received: by yhpp34 with SMTP id p34so4947866yhp.22 for ; Mon, 19 Dec 2011 02:22:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=bIrUaE4/QLw8qM4xi76Zl2H68iCmRx+WSm4CCQs42f4=; b=m9c5o6NpXeFLL5mJiXyDUPyLOVVm7I9Sn+egZJAE5Yl++71cEblDxK4caXifASSEil kgxXduUpVzBgddKUes42cH/u+ChPUrYnGagwwzmyl37IyKNnSGPHkqcjn5dustX1emTD j36HIwgmHpOk/qTyHcF1g7s160Qm0vyX/aD7E= Received: by 10.236.174.2 with SMTP id w2mr26562206yhl.35.1324290120225; Mon, 19 Dec 2011 02:22:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.146.58.42 with HTTP; Mon, 19 Dec 2011 02:21:39 -0800 (PST) In-Reply-To: <1324210922.3776.57.camel@ubuntu> References: <1323436816.21905.28.camel@ubuntu> <1323697054.3776.4.camel@ubuntu> <1323698968.3776.10.camel@ubuntu> <1323701915.3776.27.camel@ubuntu> <1323703433.3776.28.camel@ubuntu> <1323951362.12084.8.camel@ubuntu> <1324126539.3776.40.camel@ubuntu> <1324210922.3776.57.camel@ubuntu> From: =?UTF-8?B?THVrw6HFoSBWbMSNZWs=?= Date: Mon, 19 Dec 2011 11:21:39 +0100 Message-ID: Subject: Re: Switching from 0.6 to 0.7.1 - address parsing, CRLF issues To: mime4j-dev@james.apache.org Content-Type: multipart/alternative; boundary=20cf305639e932146704b46f523a X-Virus-Checked: Checked by ClamAV on apache.org --20cf305639e932146704b46f523a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks, this helped me. Regards, Lukas On Sun, Dec 18, 2011 at 1:22 PM, Oleg Kalnichevski wrote= : > On Sun, 2011-12-18 at 12:57 +0100, Stefano Bagnara wrote: > > 2011/12/18 Luk=C3=A1=C5=A1 Vl=C4=8Dek : > > > Hi again, > > > > > > there is another difference between 0.6 and 0.7.1 > > > > > > It happens when I need to parse message with weird charset 'x-gbk'. > > > > > > I added a new test case into my github repo for both 0.6 and 0.7.1 > versions. > > > Basically the problem happens when I try to get Reader from the > TextBody: > > > > > > Message message =3D getMessage(....); > > > TextBody body =3D (TextBody) message.getBody(); > > > body.getReader(); // here the exception is fired > > > > > > It worked fine in 0.6 but it yields UnsupportedEncodingException in > 0.7.1 > > > which is quite unfortunate because I do not see way how to extract bo= dy > > > content from it in this case (as I need to get the Reader first). > > > > > > Here are examples: > > > 0.6 > > > > https://github.com/lukas-vlcek/mime4j-test/blob/backto06/src/test/java/or= g/mime4j/test/BasicTest.java#L134 > > > 0.7.1 > > > > https://github.com/lukas-vlcek/mime4j-test/blob/workaround/src/test/java/= org/mime4j/test/BasicTest.java#L134 > > > > > > Any idea hot to deal with this situation? > > > > > > Note, I understand that 'x-gbk' is unknown charset for JVM but even i= n > such > > > case I was able to extract the body content by forcing 'gbk' charset > > > instead into my utility classes in 0.6, however, with 0.7.1 I am > unable to > > > do it because the very basic body.getReader call fails... is there an= y > > > workaround how to get the body Reader and not to get the exception? > > > > Please open a JIRA issue, attach your test case and the stack trace of > > the exception you get. > > I guess we can classify this as a bug because we want to give users a > > way to deal with malformed stuff, so also unrecognized charsets. > > > > I don't know if we already have an existing workaround but the JIRA > > issue will anyway help keeping track of the issue for future users. > > > > Stefano > > > There's no need to raise a JIRA, because basically there is no issue. > #getReader is merely a convenience method. One can always use > #getInputStream() to get raw data stream and apply whatever charset > encoding. > > Luk=C3=A1=C5=A1, what is wrong with that? > > --- > Message message =3D > ParserUtil.getMessage(getInputStream("mbox/jboss-as7-dev-01.mbox")); > > assertTrue(message.getBody() instanceof TextBody); > TextBody body =3D (TextBody) message.getBody(); > > String charset =3D message.getCharset(); > if (charset.equalsIgnoreCase("x-gbk")) { > charset =3D "gbk"; > } > Reader reader =3D new InputStreamReader(body.getInputStream(), charset); > --- > > > --20cf305639e932146704b46f523a--