Viewing some samba diffs I noticed: for(i = 0; i < len; i++) { - if(isupper(src[i]) ||islower(src[i]) || isdigit(src[i])) + int val = (src[i] & 0xff); + if(isupper(val) ||islower(val) || isdigit(val)) dest[i] = src[i]; else dest[i] = '_'; AFAIK the ANSI ctype functions are only guaranteed to yield valid results if isascii() is true. So maybe write: if(isascii(val) &&(isupper(val) ||islower(val) || isdigit(val))) (An Umlaut may make a difference: islower('?')) Regards, Ulrich