@Test
public void testParseUTF8Entity() throws Exception {

    final String ru_hello = constructString(RUSSIAN_HELLO);
    final String ch_hello = constructString(SWISS_GERMAN_HELLO);
    final List <NameValuePair> parameters = new ArrayList<>();
    parameters.add(new BasicNameValuePair("russian", ru_hello));
    parameters.add(new BasicNameValuePair("swiss", ch_hello));
    final String s = WWWFormCodec.format(parameters, StandardCharsets.UTF_8);
    Assert.assertEquals("russian=%D0%92%D1%81%D0%B5%D0%BC_%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82" +
            "&swiss=Gr%C3%BCezi_z%C3%A4m%C3%A4", s);
    final StringEntity entity = new StringEntity(s,
            ContentType.APPLICATION_FORM_URLENCODED.withCharset(StandardCharsets.UTF_8));
    final List<NameValuePair> result = EntityUtils.parse(entity);
    Assert.assertEquals(2, result.size());
    assertNameValuePair(result.get(0), "russian", ru_hello);
    assertNameValuePair(result.get(1), "swiss", ch_hello);
}