Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Unsupported Encoding

9 views
Skip to first unread message

none

unread,
May 26, 2006, 7:16:06 PM5/26/06
to
I'm in the process of writing a mail client using javamail, but have
come across some text encoding problems. When a message has content of
the iso-8859-10, iso-8859-14 and iso-8859-16 types i get an
'UnsupportedEncodingException' when trying to retrieve the message
content. Below is an example stack trace.

java.io.UnsupportedEncodingException: iso-8859-10
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 com.sun.mail.handlers.text_plain.getContent(text_plain.java:64)
at
javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:745)
at javax.activation.DataHandler.getContent(DataHandler.java:501)
at javax.mail.internet.MimeMessage.getContent(MimeMessage.java:1332)
at com.devisland.webmail.MailLayer.hasAttachment(MailLayer.java:145)

What the best way to add support for these encodings? i'm not familar
with the sun.io.converters package. Any help would be great.

Thanks in advance,

Tim

Chris Smith

unread,
May 26, 2006, 10:55:19 PM5/26/06
to
<none <""tim\"@(none)">> wrote:
> I'm in the process of writing a mail client using javamail, but have
> come across some text encoding problems. When a message has content of
> the iso-8859-10, iso-8859-14 and iso-8859-16 types i get an
> 'UnsupportedEncodingException' when trying to retrieve the message
> content. Below is an example stack trace.

> What the best way to add support for these encodings? i'm not familar
> with the sun.io.converters package. Any help would be great.

I don't know, actually. However, the stack trace mentions NIO. You
might try starting with java.nio.charset.spi.CharsetProvider. I am not
sure it'll work, so you might try creating a toy charset first, before
you start with all the rote work of transcribing those ISO standards
into Java.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Dale King

unread,
May 30, 2006, 12:32:52 AM5/30/06
to
none wrote:
> I'm in the process of writing a mail client using javamail, but have
> come across some text encoding problems. When a message has content of
> the iso-8859-10, iso-8859-14 and iso-8859-16 types i get an
> 'UnsupportedEncodingException' when trying to retrieve the message
> content. Below is an example stack trace.
>
> java.io.UnsupportedEncodingException: iso-8859-10

According to the list of supported encodings none of those three are
supported:

http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html

> What the best way to add support for these encodings? i'm not familar
> with the sun.io.converters package. Any help would be great.

You should be looking in java.nio.charset and in addition you will need
to look at java.nio.charset.spi since you will have to create a service
provider. If you only care about decoding then your job will be pretty
simple.

--
Dale King

0 new messages