Skip to content

Commit

Permalink
Default to UTF-8 encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
btk5h committed May 4, 2018
1 parent aaf52af commit d79802b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/main/java/com/btk5h/reqn/skript/EffRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,12 @@
import org.bukkit.event.Event;
import org.eclipse.jdt.annotation.Nullable;

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.*;
import java.lang.reflect.Field;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -179,8 +176,8 @@ private HttpResponse sendRequest(Event e) {
conn.setRequestProperty("Content-Length", Integer.toString(body.getBytes().length));
conn.setRequestMethod(method);
conn.setDoOutput(true);
try (DataOutputStream out = new DataOutputStream(conn.getOutputStream())) {
out.writeBytes(body);
try (OutputStreamWriter out = new OutputStreamWriter(conn.getOutputStream(), StandardCharsets.UTF_8)) {
out.write(body);
}
} else if (!body.equals("")) {
Skript.warning("Get requests should not have a body");
Expand Down

0 comments on commit d79802b

Please sign in to comment.