Skip to content
  • jianli@chromium.org's avatar
    Refactor text encoding detection logic in FileReader. · b9a7ac12
    jianli@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=39131
    
    Reviewed by Alexey Proskuryakov.
    
    WebCore:
    
    Changed FileReader::convertToText to call TextResourceDecoder::decode to
    detect the encoding from BOM and decode the text. Though the File API
    spec says that the supplied encoding should be used if it is valid, we
    choose to ignore this requirement in order to be consistent with how
    WebKit decodes the web content: always has the BOM override the provided
    encoding.
    
    * html/FileReader.cpp:
    (WebCore::FileReader::convertToText):
    * html/FileReader.h:
    
    LayoutTests:
    
    Add more test coverage for FileReader.
    
    * fast/files/file-reader-expected.txt:
    * fast/files/file-reader.html:
    * fast/files/resources/binary-file: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@59797 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    b9a7ac12