Android HttpPost编码到windows-1255每个字符添加25个字符

Android HttpPost编码到windows-1255每个字符添加25个字符,android,http-post,httpclient,Android,Http Post,Httpclient,我试图用httpPost将数据发送到服务器。 它看起来像这样: String username = URLEncoder.encode("myUsername","windows-1255"); HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost("****"); List<NameValuePair> pairs = new ArrayList<NameValuePair>(

我试图用httpPost将数据发送到服务器。 它看起来像这样:

String username = URLEncoder.encode("myUsername","windows-1255");
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost("****");
List<NameValuePair> pairs = new ArrayList<NameValuePair>();
pairs.add(new BasicNameValuePair("username", username));
post.setEntity(new UrlEncodedFormEntity(pairs));
HttpResponse response = client.execute(post);
但它将以%25XX而不是%XX的形式发送到服务器。
为什么会发生这种情况?

我需要将实体添加为字符串而不是列表:

String param="username"+username;
post.setEntity(new StringEntity(param));

它是%。更多的废话不是答案。每%代表一个url编码字符。请查查。请确切地告诉我您发送的字符串和收到的字符串。我的意思是解码后%25为%25。不要首先对用户名进行编码,因为所有用户名都将使用新的UrlEncodedFormEntity进行编码。我需要这样做,因为我将其作为字符集windows-1255发送。无论如何,我找到了一个解决方案。感谢您的帮助