[ https://issues.apache.org/jira/browse/TIKA-2592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16384242#comment-16384242 ]
Ken Krugler commented on TIKA-2592: ----------------------------------- [~AndreasMeier] - I assume when you said: {quote}I don't think we should treat unicode as a suspicious charset name in general, just for html since there is a difference between java and html. {quote} That you were referring to the difference between what Java's CharSet class says is a valid name, and the set of names in the [IANA standard|https://www.iana.org/assignments/character-sets/character-sets.xhtml], right? If so, then I agree that what's needed is a list of valid IANA charset names, and we should ignore any charset name in the HTML that's not in this set. Unfortunately Java appears to have a bug, where even though "unicode" isn't a valid IANA charset name, that CharSet returns true from the [isRegistered()|https://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html#isRegistered()] method. So to make this work, we'd need to roll our own, e.g. using the attached list of names. > HTML with charset unicode handled as utf-16 instead utf-8 > --------------------------------------------------------- > > Key: TIKA-2592 > URL: https://issues.apache.org/jira/browse/TIKA-2592 > Project: Tika > Issue Type: Improvement > Affects Versions: 2.0, 1.16, 1.17 > Reporter: Andreas Meier > Priority: Minor > Attachments: IANA Charset names.txt, TestCharsetUnicodeHTML.html, > TestHTMLCharsetArabicCP1256.html, TestHTMLCharsetCP1256.html, > fix-for-TIKA2592-contributed-by-Andreas-Meier.patch > > > HTML files are detected as utf-16 when meta content is set to "unicode". > {code:XML} > <meta http-equiv="Content-Type" content="text/html; charset="unicode"> > {code} > > Shouldn't the default be utf-8? > The attached sample file is shown correctly in: > Chromium Version 55.0.2883.75 > Firefox 50.1.0 > IE 11 > I am aware that there is no charset "unicode" (available character encodings: > [http://www.iana.org/assignments/character-sets/character-sets.xhtml|http://www.iana.org/assignments/character-sets/character-sets.xhtml]) > Unfortunately there are many wrong encodings used out there. > All unknown encodings should be validated or at least be set to default utf-8. > Regards > Andreas -- This message was sent by Atlassian JIRA (v7.6.3#76005)