Skip to content

Commit d92d5a0

Browse files
committed
Merge pull request #12 from mactkg/encoding-select
Select encoding
2 parents 5f32946 + 152a987 commit d92d5a0

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

resources/library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ version = 1 # This must be parsable as an int
4646

4747
# The version as the user will see it. If blank, the version attribute will be
4848
# used here.
49-
prettyVersion = 0.1.1 # This is treated as a String
49+
prettyVersion = 0.1.2 # This is treated as a String

src/http/requests/PostRequest.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,18 @@ public class PostRequest
2626
HashMap<String,File> nameFilePairs;
2727

2828
String content;
29+
String encoding;
2930
HttpResponse response;
3031

31-
public PostRequest(String url)
32+
public PostRequest(String url)
33+
{
34+
this(url, "ISO-8859-1");
35+
}
36+
37+
public PostRequest(String url, String encoding)
3238
{
3339
this.url = url;
40+
this.encoding = encoding;
3441
nameValuePairs = new ArrayList<BasicNameValuePair>();
3542
nameFilePairs = new HashMap<String,File>();
3643
}
@@ -57,7 +64,7 @@ public void send()
5764
HttpPost httpPost = new HttpPost(url);
5865

5966
if (nameFilePairs.isEmpty()) {
60-
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
67+
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, encoding));
6168
} else {
6269
MultipartEntity mentity = new MultipartEntity();
6370
Iterator<Entry<String,File>> it = nameFilePairs.entrySet().iterator();

0 commit comments

Comments
 (0)