private static bool IsSafeForCurrentCultureComparisons(string str)
{
for (int i = 0; i < str.Length; i++)
{
char c = str[i];
// We only want ASCII chars that you can see
// No controls, no delete, nothing >= 0x80
if (c < 0x20 || c == 0x7f || c >= 0x80)
{
return false;
}
}
return true;
}