diff options
author | Xavier Roche <xroche@users.noreply.github.com> | 2012-05-06 16:58:45 +0000 |
---|---|---|
committer | Xavier Roche <xroche@users.noreply.github.com> | 2012-05-06 16:58:45 +0000 |
commit | aad35562b3293c792e858b36c3ca7d1ab2f386c6 (patch) | |
tree | 50652bd9c9961168c819ed00310625c1ab46f570 /src/htsparse.c | |
parent | 4ec5ea4991a424c461eb7f9c4f92e6e3fa5c3f89 (diff) |
Minor fixes regarding utf-8 filename handling
Diffstat (limited to 'src/htsparse.c')
-rw-r--r-- | src/htsparse.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/htsparse.c b/src/htsparse.c index f127f0d..18059f5 100644 --- a/src/htsparse.c +++ b/src/htsparse.c @@ -54,6 +54,7 @@ Please visit our Website: http://www.httrack.com #include "htsbauth.h" #include "htsmd5.h" #include "htsindex.h" +#include "htscharset.h" /* external modules */ #include "htsmodules.h" @@ -2783,6 +2784,21 @@ int htsparse(htsmoduleStruct* str, htsmoduleStructExtended* stre) { } } + // convert to local codepage + if (str->page_charset_ != NULL && *str->page_charset_ != '\0') { + char *const local_save = hts_convertStringFromUTF8(tempo, strlen(tempo), str->page_charset_); + if (local_save != NULL) { + strcpybuff(tempo, local_save); + free(local_save); + } else { + if ((opt->debug>1) && (opt->log!=NULL)) { + HTS_LOG(opt,LOG_DEBUG); + fprintf(opt->log, "Warning: could not build local charset representation of '%s' in '%s'"LF, tempo, str->page_charset_); + test_flush; + } + } + } + // put original query string if any (ex: "www.example.com/foo4242.html?q=45) pos = strchr(fil, '?'); if (pos != NULL) { @@ -2872,6 +2888,21 @@ int htsparse(htsmoduleStruct* str, htsmoduleStructExtended* stre) { } if ((opt->getmode & 1) && (ptr>0)) { + // convert to local codepage - NOT, already converted into %NN, and passed to the remote server so we do not have anything to do + //if (str->page_charset_ != NULL && *str->page_charset_ != '\0') { + // char *const local_save = hts_convertStringFromUTF8(tempo, strlen(tempo), str->page_charset_); + // if (local_save != NULL) { + // strcpybuff(tempo, local_save); + // free(local_save); + // } else { + // if ((opt->debug>1) && (opt->log!=NULL)) { + // HTS_LOG(opt,LOG_DEBUG); + // fprintf(opt->log, "Warning: could not build local charset representation of '%s' in '%s'"LF, tempo, str->page_charset_); + // test_flush; + // } + // } + //} + // écrire le lien modifié, relatif // Note: escape all chars, even >127 (no UTF) HT_ADD_HTMLESCAPED_FULL(tempo); |