Unsupported Encoding

N

none

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
 
C

Chris Smith

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
 
D

Dale King

none said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,259
Messages
2,571,035
Members
48,768
Latest member
first4landlord

Latest Threads

Top