diff options
author | Xavier Roche <xroche@users.noreply.github.com> | 2012-05-07 10:02:58 +0000 |
---|---|---|
committer | Xavier Roche <xroche@users.noreply.github.com> | 2012-05-07 10:02:58 +0000 |
commit | 525118dfe8bb3f6b874db7920dc0ee04eede0585 (patch) | |
tree | c2f57a84561e427c09ea7a248f438c187a004c58 /src/htscore.c | |
parent | aad35562b3293c792e858b36c3ca7d1ab2f386c6 (diff) |
Charset fixes
Diffstat (limited to 'src/htscore.c')
-rw-r--r-- | src/htscore.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/htscore.c b/src/htscore.c index de202db..6e2b198 100644 --- a/src/htscore.c +++ b/src/htscore.c @@ -249,7 +249,10 @@ if (!makeindex_done) { \ if (makeindex_fp) { \ char BIGSTK tempo[1024]; \ if (makeindex_links == 1) { \ - sprintf(tempo,"<meta HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=%s\">"CRLF,makeindex_firstlink); \ + char BIGSTK link_escaped[HTS_URLMAXSIZE*2]; \ + strcpybuff(link_escaped, makeindex_firstlink); \ + escape_check_url(link_escaped); \ + sprintf(tempo,"<meta HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=%s\">"CRLF, link_escaped); \ } else \ tempo[0]='\0'; \ fprintf(makeindex_fp,template_footer, \ @@ -1461,6 +1464,12 @@ int httpmirror(char* url1, httrackp* opt) { if (charset != NULL) free(charset); } + /* Could not detect charset: could it be UTF-8 ? */ + if (page_charset[0] == '\0') { + if (is_unicode_utf8(r.adr, r.size)) { + strcpy(page_charset, "utf-8"); + } + } /* Could not detect charset */ if (page_charset[0] == '\0') { if ( (opt->debug>0) && (opt->log!=NULL) ) { @@ -1741,7 +1750,7 @@ int httpmirror(char* url1, httrackp* opt) { // a partir d'ici le slash devient antislash #endif - if ((fp=fopen(tempo,"wb"))!=NULL) { + if ((fp=FOPEN(tempo,"wb"))!=NULL) { fprintf(fp,"Info-file generated by HTTrack Website Copier "HTTRACK_VERSION"%s"CRLF""CRLF, hts_get_version_info(opt)); fprintf(fp,"The file %s has not been scanned by HTS"CRLF,savename); fprintf(fp,"Some links contained in it may be unreachable locally."CRLF); |