From: Saint Xavier Date: Sun, 25 May 2008 01:49:00 +0000 (+0200) Subject: Detect HTTP Content-Type server encoding X-Git-Tag: v1.13~338^2~7^2~6^2~13^2~30 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=4aab9e8f0af29d8fb5d59746e4e5270080f95468 Detect HTTP Content-Type server encoding --- diff --git a/src/http.c b/src/http.c index 11dc9cc8..682258c0 100644 --- a/src/http.c +++ b/src/http.c @@ -2040,9 +2040,32 @@ File %s already there; not retrieving.\n\n"), quote (hs->local_file)); char *tmp = strchr (type, ';'); if (tmp) { +#ifdef ENABLE_IRI + char *tmp2 = tmp + 1; +#endif + while (tmp > type && c_isspace (tmp[-1])) --tmp; *tmp = '\0'; + +#ifdef ENABLE_IRI + if (opt.enable_iri && *tmp2 != '\0' && + (tmp = strstr (tmp2, "charset=")) != NULL) + { + tmp += 8; + tmp2 = tmp; + + while (*tmp2 && !c_isspace (*tmp2)) + tmp2++; + + if (tmp2 > tmp) + { + *tmp2 = '\0'; + /* sXXXav : check given charset */ + logprintf (LOG_VERBOSE, "HTTP charset: `%s'\n", tmp); + } + } +#endif } } hs->newloc = resp_header_strdup (resp, "Location");