summaryrefslogtreecommitdiff
path: root/namegen.c
diff options
context:
space:
mode:
Diffstat (limited to 'namegen.c')
-rw-r--r--namegen.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/namegen.c b/namegen.c
index 4e1946a9c..8403bec68 100644
--- a/namegen.c
+++ b/namegen.c
@@ -480,13 +480,15 @@ static byte MakeCzechTownName(char *buf, uint32 seed, const char *last)
strecat(buf, name_czech_adj[prefix].name, last);
endpos = strlen(buf) - 1;
+ /* Find the first character in a UTF-8 sequence */
+ while (GB(buf[endpos], 6, 2) == 2) endpos--;
if (gender == CZG_SMASC && pattern == CZP_PRIVL) {
/* -ovX -> -uv */
buf[endpos - 2] = 'u';
assert(buf[endpos - 1] == 'v');
buf[endpos] = '\0';
} else {
- buf[endpos] = name_czech_patmod[gender][pattern];
+ strecpy(buf + endpos, name_czech_patmod[gender][pattern], last);
}
strecat(buf, " ", last);