StringUtil.resolveEncodingAlias  is unuseful.
---------------------------------------------

                 Key: NUTCH-369
                 URL: http://issues.apache.org/jira/browse/NUTCH-369
             Project: Nutch
          Issue Type: Bug
          Components: fetcher
    Affects Versions: 0.8
         Environment: all
            Reporter: King Kong


After we defined encoding alias map in StringUtil , but parse html use orginal 
encoding also.

I found it is reading charset from  meta in nekohtml which HtmlParser  used .

we can set it's feature 
"http://cyberneko.org/html/features/scanner/ignore-specified-charset"; to true 
that nekohtml will use encoding we set;

concretely,

  private DocumentFragment parseNeko(InputSource input) throws Exception {
    DOMFragmentParser parser = new DOMFragmentParser();
    // some plugins, e.g., creativecommons, need to examine html comments
    try {
   + 
parser.setFeature("http://cyberneko.org/html/features/scanner/ignore-specified-charset",true);
      parser.setFeature("http://apache.org/xml/features/include-comments";, 
              true);
      ....


BTW, It must be add on front of try block,because the following sentence  
(parser.setFeature("http://apache.org/xml/features/include-comments";, 
              true);) will throw exception.


     


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nutch-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nutch-developers

Reply via email to