There's no point in looping the full length of the string.
The last character of the name will be followed by a null terminator which has the integer value 0 or char value '\0'
So you can loop
Code:
while (num = nameBuf[i++])
{
if (num>160)
{
uni=true;
}
}
or similar.