branch | gamebalance |
changeset 9895 | 7bd07f43b0e3 |
parent 6544 | a5f64ee6e4d6 |
child 6719 | 4cc327ad39d5 |
--- a/src/string.cpp Mon Mar 19 09:33:17 2007 +0000 +++ b/src/string.cpp Mon Mar 19 12:38:16 2007 +0000 @@ -282,7 +282,8 @@ for (const char *ptr = strchr(s, '\0'); *s != '\0';) { size_t len = Utf8EncodedCharLen(*s); - if (len == 0) break; // invalid encoding + /* Silently ignore invalid UTF8 sequences, our only concern trimming */ + if (len == 0) len = 1; /* Take care when a hard cutoff was made for the string and * the last UTF8 sequence is invalid */