I am using wget locally to take a static snapshot of a small web app. When I do, the resulting html files come back with strange characters in place of quotation marks and apostrophes.
What can I do to avoid this behavior?
Thanks.
Join Stack Overflow to learn, share knowledge, and build your career.
I am using wget locally to take a static snapshot of a small web app. When I do, the resulting html files come back with strange characters in place of quotation marks and apostrophes.
What can I do to avoid this behavior?
Thanks.
I would suggest trying with:
--restrict-file-names=nocontrol
ascii
instead of nocontrol
) finally gave me the solution I needed. Somehow I skipped over it when reading the wget man.
– Max Starkenburg
Sep 11 '15 at 15:56
vms
so an address with a query string would turn the ?
into @
. you can see the options by offering no option or a wrong one.
– cregox
Dec 3 '20 at 8:23
Sounds like you need to specify --remote-encoding
perhaps --remote-encoding=utf-8
.
--local-encoding=utf-8
fixed it for me.
– CivFan
Jun 23 '20 at 23:23
I had this same problem but then I found out that my browser showed the web page with wrong enconding. For example in Firefox I just needed to change View -> Character Encoding -> Unicode.
I had such issue too. It appeared the page I was downloading were gziped. You can check this using the -S option in wget. You will find a
Content-Encoding: gzip
line. In such case I use zcat to read the file.
It seems that wget
can't guess the encoding so you need this in your html response of your web app:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
I had this vary same problem (a wget
mirror with special characters and quotation marks shown as Unicode "unknown char", ?
) when browsing the mirror.
The problem turned to be related to the different servers encoding, rather than depending on wget
. The original server was a old Windows+IIS installation configured to serve HTML pages with ISO-8859 encoding, while the mirror was an Linux+Apache server configured to serve UTF-8 pages.
The solution was to configure Apache to serve ISO-8859 pages, adding to the right virtual host the directive AddDefaultCharset ISO-8859-1