Skip to content

Commit

Permalink
fix(transcriptions): When posting json make sure it is UTF-8.
Browse files Browse the repository at this point in the history
  • Loading branch information
damencho committed Sep 23, 2024
1 parent b49e1f7 commit 9efec41
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/org/jitsi/jigasi/transcription/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import java.io.*;
import java.net.*;
import java.nio.charset.*;

/**
* Utility functions used in the transcription package.
Expand Down Expand Up @@ -49,10 +50,10 @@ public static void postJSON(String address, JSONObject json)
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8");

OutputStream os = conn.getOutputStream();
os.write(json.toString().getBytes());
os.write(json.toString().getBytes(StandardCharsets.UTF_8));
os.flush();

if (conn.getResponseCode() != HttpURLConnection.HTTP_OK)
Expand Down

0 comments on commit 9efec41

Please sign in to comment.