mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
faster way of extracting declared encoding
This commit is contained in:
@@ -6,6 +6,7 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.lang.SystemUtils;
|
import org.apache.commons.lang.SystemUtils;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
@@ -38,7 +39,7 @@ public class FeedParser {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
InputSource source = new InputSource(new ByteArrayInputStream(xml));
|
InputSource source = new InputSource(new ByteArrayInputStream(xml));
|
||||||
if (new String(xml).split(SystemUtils.LINE_SEPARATOR)[0]
|
if (new String(ArrayUtils.subarray(xml, 0, 100)).split(SystemUtils.LINE_SEPARATOR)[0]
|
||||||
.toUpperCase().contains("ISO-8859-1")) {
|
.toUpperCase().contains("ISO-8859-1")) {
|
||||||
// they probably use word, we need to handle curly quotes and
|
// they probably use word, we need to handle curly quotes and
|
||||||
// other word special characters
|
// other word special characters
|
||||||
|
|||||||
Reference in New Issue
Block a user