From: Peter Verthez Date: Sun, 26 Jan 2003 20:18:58 +0000 (+0000) Subject: Convert spaces to underscores in GEDCOM name for encoding (to search X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=ab4836dc707290f66f59935e7be82d263d1b6d09;p=gedcom-parse.git Convert spaces to underscores in GEDCOM name for encoding (to search in configuration file). --- diff --git a/gedcom/encoding.c b/gedcom/encoding.c index 1cae728..c2c3e89 100644 --- a/gedcom/encoding.c +++ b/gedcom/encoding.c @@ -89,6 +89,10 @@ char* get_encoding(const char* gedcom_n, Encoding enc) key = (char*)malloc(strlen(gedcom_n) + strlen(charwidth_string[enc]) + 3); if (key) { + char* sp_pos = NULL; + while ((sp_pos = strchr(gedcom_n, ' ')) != NULL) { + *sp_pos = '_'; + } /* sprintf is safe here (malloc'ed before) */ sprintf(key, "%s(%s)", gedcom_n, charwidth_string[enc]);