NameValuePair param4 = new NameValuePair("param", "quote marks (\") must be escaped");
NameValuePair param5 = new NameValuePair("param", "back slash (\\) must be escaped too");
NameValuePair param6 = new NameValuePair("param", "values with\tblanks must always be quoted");
formatter.setAlwaysUseQuotes(false);
assertEquals("param=regular_stuff", formatter.format(param1));
assertEquals("param=\"this\\\\that\"", formatter.format(param2));
assertEquals("param=\"this,that\"", formatter.format(param3));
assertEquals("param=\"quote marks (\\\") must be escaped\"", formatter.format(param4));
assertEquals("param=\"back slash (\\\\) must be escaped too\"", formatter.format(param5));
assertEquals("param=\"values with\tblanks must always be quoted\"", formatter.format(param6));