Re: UnsupportedEncodingException for unicode-1-1-utf-7

Chris Burdess <[email protected]> Fri, 27 Nov 2009 14:28:22 +0000
Newsgroups gmane.comp.java.classpath.extensions.javamail
Message-ID <[email protected]>
Boris Folgmann wrote:
> I get this exception when parsing an email:
>=20
> java.io.UnsupportedEncodingException: unicode-1-1-utf-7	at =
sun.io.Converters.getConverterClass(Converters.java:218)	at =
sun.io.Converters.newConverter(Converters.java:251)	at =
sun.io.ByteToCharConverter.getConverter(ByteToCharConverter.java:68)	=
at sun.nio.cs.StreamDecoder$ConverterSD.<init>(StreamDecoder.java:224)	=
at sun.nio.cs.StreamDecoder$ConverterSD.<init>(StreamDecoder.java:210)	=
at sun.nio.cs.StreamDecoder.forInputStreamReader(StreamDecoder.java:77)	=
at java.io.InputStreamReader.<init>(InputStreamReader.java:83)	at =
gnu.mail.handler.Text.getContent(Text.java:106)	at =
javax.activationDataSourceDataContentHandler.getContent(DataHandler.java:8=
03) at javax.activation.DataHandler.getContent(DataHandler.java:550)	=
at javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:691)	=
at =
gnu.mail.providers.imap.IMAPBodyPart.getContent(IMAPBodyPart.java:282)
>=20
> The encoding might be unsupported by JavaSE 5.0, but as it is a common =
encoding of emails, as you can read in RFC1642 (UTF-7 - A Mail-Safe =
Transformation Format of Unicode), I don't see why javamail shouldn't =
support it.
>=20
> Is it possible to implement a dirty work-around like forcing the =
BodyPart's encoding to US-ASCII before calling getContent()? I couldn't =
find a suitable method.

UTF7 is supported, however I have never heard of anything being =
identified as "unicode-1-1-utf-7". Do you have a copy of the original =
message to hand?
--=20
Chris Burdess