UnsupportedEncodingException for unicode-1-1-utf-7

Boris Folgmann <[email protected]> Fri, 27 Nov 2009 13:38:22 +0100
Newsgroups gmane.comp.java.classpath.extensions.javamail
Message-ID <[email protected]>
Hi,

I get this exception when parsing an email:

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:803) 
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)

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.

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.

cu,
	boris