| -rw-r--r-- | cgitrc.5.txt | 5 | ||||
| -rw-r--r-- | parsing.c | 24 |
2 files changed, 11 insertions, 18 deletions
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 65b210f..be8483c 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -287,9 +287,8 @@ scan-path:: the result will be cached as a cgitrc include-file in the cache directory. If project-list has been defined prior to scan-path, scan-path loads only the directories listed in the file pointed to by - project-list. Be advised that only the global settings taken - before the scan-path directive will be applied to each repository. - Default value: none. See also: cache-scanrc-ttl, project-list. + project-list. Default value: none. See also: cache-scanrc-ttl, + project-list. section:: The name of the current repository section - all repositories defined @@ -106,11 +106,7 @@ const char *reencode(char **txt, const char *src_enc, const char *dst_enc) if (!txt || !*txt || !src_enc || !dst_enc) return *txt; - /* no encoding needed if src_enc equals dst_enc */ - if(!strcasecmp(src_enc, dst_enc)) - return *txt; - - tmp = reencode_string(*txt, dst_enc, src_enc); + tmp = reencode_string(*txt, src_enc, dst_enc); if (tmp) { free(*txt); *txt = tmp; @@ -164,10 +160,6 @@ struct commitinfo *cgit_parse_commit(struct commit *commit) } } - /* if no special encoding is found, assume UTF-8 */ - if(!ret->msg_encoding) - ret->msg_encoding = xstrdup("UTF-8"); - // skip unknown header fields while (p && *p && (*p != '\n')) { p = strchr(p, '\n'); @@ -197,12 +189,14 @@ struct commitinfo *cgit_parse_commit(struct commit *commit) } else ret->subject = xstrdup(p); - reencode(&ret->author, ret->msg_encoding, PAGE_ENCODING); - reencode(&ret->author_email, ret->msg_encoding, PAGE_ENCODING); - reencode(&ret->committer, ret->msg_encoding, PAGE_ENCODING); - reencode(&ret->committer_email, ret->msg_encoding, PAGE_ENCODING); - reencode(&ret->subject, ret->msg_encoding, PAGE_ENCODING); - reencode(&ret->msg, ret->msg_encoding, PAGE_ENCODING); + if (ret->msg_encoding) { + reencode(&ret->author, PAGE_ENCODING, ret->msg_encoding); + reencode(&ret->author_email, PAGE_ENCODING, ret->msg_encoding); + reencode(&ret->committer, PAGE_ENCODING, ret->msg_encoding); + reencode(&ret->committer_email, PAGE_ENCODING, ret->msg_encoding); + reencode(&ret->subject, PAGE_ENCODING, ret->msg_encoding); + reencode(&ret->msg, PAGE_ENCODING, ret->msg_encoding); + } return ret; } |