Uploaded image for project: 'Nutch'
  1. Nutch
  2. NUTCH-91

empty encoding causes exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.8
    • 0.7.2, 0.8
    • None
    • None

    Description

      I found some sites, where the header says: "Content-Type: text/html; charset=". This causes an exception in the HtmlParser. My suggestion:

      Index: src/plugin/parse-html/src/java/org/apache/nutch/parse/html/HtmlParser.java
      ===================================================================
      — src/plugin/parse-html/src/java/org/apache/nutch/parse/html/HtmlParser.java (revision 279397)
      +++ src/plugin/parse-html/src/java/org/apache/nutch/parse/html/HtmlParser.java (working copy)
      @@ -120,7 +120,7 @@
      byte[] contentInOctets = content.getContent();
      InputSource input = new InputSource(new ByteArrayInputStream(contentInOctets));
      String encoding = StringUtil.parseCharacterEncoding(contentType);

      • if (encoding!=null) {
        + if (encoding!=null && !"".equals(encoding)) {
        metadata.put("OriginalCharEncoding", encoding);
        if ((encoding = StringUtil.resolveEncodingAlias(encoding)) != null) {
        metadata.put("CharEncodingForConversion", encoding);

      Attachments

        Activity

          People

            Unassigned Unassigned
            mnebel Michael Nebel
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: