java.io.UnsupportedEncodingException: latin-iso8859-1

Bug #678333 reported by Adrian Gruntkowski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Groundhog Usenet Reader
In Progress
Undecided
Unassigned

Bug Description

The problem is (probably) due to non-standard (malformed?) charset string.
Here's the backtrace:

W/MimeEntity( 2154): Unexpected end of headers detected. Higher level boundary detected or EOF reached.
W/BodyFactory( 2154): MIME charset 'latin-iso8859-1' has no corresponding Java charset. Using Charset[US-ASCII] instead.
W/System.err( 2154): java.io.UnsupportedEncodingException: latin-iso8859-1
W/System.err( 2154): at java.lang.String.getCharset(String.java:1039)
W/System.err( 2154): at java.lang.String.<init>(String.java:438)
W/System.err( 2154): at java.lang.String.<init>(String.java:474)
W/System.err( 2154): at com.almarsoft.GroundhogReader.lib.MessageTextProcessor.decodeSubject(MessageTextProcessor.java:77)
W/System.err( 2154): at com.almarsoft.GroundhogReader.MessageActivity$LoadMessageTask.doInBackground(MessageActivity.java:776)
W/System.err( 2154): at com.almarsoft.GroundhogReader.MessageActivity$LoadMessageTask.doInBackground(MessageActivity.java:1)
W/System.err( 2154): at android.os.AsyncTask$2.call(AsyncTask.java:185)
W/System.err( 2154): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
W/System.err( 2154): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
W/System.err( 2154): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
W/System.err( 2154): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
W/System.err( 2154): at java.lang.Thread.run(Thread.java:1096)
W/System.err( 2154): Caused by: java.nio.charset.UnsupportedCharsetException: The unsupported charset name is "latin-iso8859-1".
W/System.err( 2154): at java.nio.charset.Charset.forName(Charset.java:572)
W/System.err( 2154): at java.lang.String.getCharset(String.java:1034)
W/System.err( 2154): ... 11 more

The cause of the problem is here:
com.almarsoft.GroundhogReader.lib.MessageTextProcessor.decodeSubject(MessageTextProcessor.java:77)

All cases where String is constructed with supplied charset string, there should be additional sanity check if given charset string is known at all. If not, there could be some fallback to some sane default.

There's a method in mime4j's BodyFactory called toJavaCharset. It looks like a good start for similar solution on Groundhog's side.

Once again, I can't test it, because I don't have SDK installed. Maybe it's time to start playing with it ;)

Revision history for this message
juanjux (juanjux) wrote :

I'll test toJavaCharset and if that also fails default to iso-8859-1. Thanks for the tip and the backtrace.

Changed in groundhog:
status: New → In Progress
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.