Added UTF-8 encoding to HTTP POST

This commit is contained in:
Sven Kubiak
2018-03-26 07:49:38 +02:00
parent 6efc754126
commit 5122442940
2 changed files with 3 additions and 5 deletions

View File

@ -19,7 +19,7 @@
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<log4j.version>2.10.0</log4j.version>
<log4j.version>2.11.0</log4j.version>
<httpcomponents.version>4.5.5</httpcomponents.version>
</properties>
<scm>

View File

@ -8,7 +8,6 @@ import java.util.Objects;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.Consts;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.fluent.Form;
@ -301,6 +300,7 @@ public class JPushover {
}
HttpPost httpPost = new HttpPost(Constants.MESSAGES_URL.toString());
httpPost.addHeader("Content-Type", "text/html; charset=UTF-8");
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addTextBody(Constants.TOKEN.toString(), this.pushoverToken);
@ -356,9 +356,7 @@ public class JPushover {
}
builder.addTextBody(Constants.SOUND.toString(), this.pushoverHtml ? "1" : "0");
HttpEntity multipart = builder.build();
httpPost.setEntity(multipart);
httpPost.setEntity(builder.build());
JPushoverResponse jPushoverResponse = new JPushoverResponse().isSuccessful(false);
try {