Archivebox: Archive Method: Wget: Detect and fix downloaded file encodings to utf-8

Created on 3 Nov 2017  路  4Comments  路  Source: ArchiveBox/ArchiveBox

Best guess for encoding:

$ file -bi archive/1509683331/blog.wesleyac.com/posts/two-interview-questions.html
application/gzip; charset=binary

First un-gzip any gzipped files:

gunzip < archive/1509683331/blog.wesleyac.com/posts/two-interview-questions.html > archive/1509683331/blog.wesleyac.com/posts/two-interview-questions.decoded.html

Then re-detect encoding and normalize to UTF-8

iconv -f ISO-8859-1 -t UTF-8 archive/1509683331/blog.wesleyac.com/posts/two-interview-questions.html > archive/1509683331/blog.wesleyac.com/posts/two-interview-questions.decoded.html
bug high idea phase needs-followup

Most helpful comment

@Offirmo don't worry, the byte-for-byte data from the server is saved correctly in the WARC. Even though it's displaying incorrectly now, as we add encoding fixes later on it will update and fix older previously mangled/badly-decoded archives to display correctly.

All 4 comments

Real case: I archived http://catb.org/jargon/html/index.html

Original:
Screen Shot 2019-03-19 at 16 57 01

Archived:
Screen Shot 2019-03-19 at 16 57 08

too bad...

@Offirmo don't worry, the byte-for-byte data from the server is saved correctly in the WARC. Even though it's displaying incorrectly now, as we add encoding fixes later on it will update and fix older previously mangled/badly-decoded archives to display correctly.

@Offirmo I just tried with the django branch: archivebox add http://catb.org/jargon/html/index.html and it seems to be working correctly now.
@pirate I guess this has been fixed since. Can you please confirm and close the issue if that is the case?

@Offirmo if you see any further encoding issues on the latest django version feel free to comment back here and I can reopen this ticket.

Was this page helpful?
0 / 5 - 0 ratings