static void encodeQueryStr(StringBuilder buf, string str)
{
for (int i=0; i<str.Length; ++i)
{
int c = str[i];
if (c < 128 && (charMap[c] & QUERY) != 0 && (delimEscMap[c] & QUERY) == 0)
buf.Append((char)c);
else if (c == ' ')
buf.Append('+');
else
percentEncodeChar(buf, c);
}
}