static int str_is_utf8(int code) { return code < 0x0020 || code > 0x007e; } static void str_utf8_slug(const char *pStrning, char *pSlugged, int SizeOfSlugged) { int code; int i = 0; while(*pStrning) { code = str_utf8_decode(&pStrning); if(str_is_utf8(code)) pSlugged[i] = '?'; char aBuf[16]; str_utf8_encode(aBuf, code); pSlugged[i] = aBuf[0] == '\0' ? '?' : aBuf[0]; i++; if(i >= SizeOfSlugged) break; } pSlugged[i] = '\0'; }