From 6aaffbc5caaae3b5a85d1fcad8da04c7456fb91e Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Mon, 24 Jun 2024 10:54:08 +0200 Subject: [PATCH] fix(android): UTF-8 encode form data value (#7531) Co-authored-by: Malo <55086681+malo-malo@users.noreply.github.com> Co-authored-by: Malo --- .../getcapacitor/plugin/util/CapacitorHttpUrlConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/capacitor/src/main/java/com/getcapacitor/plugin/util/CapacitorHttpUrlConnection.java b/android/capacitor/src/main/java/com/getcapacitor/plugin/util/CapacitorHttpUrlConnection.java index 161a74d45..06f52c334 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/plugin/util/CapacitorHttpUrlConnection.java +++ b/android/capacitor/src/main/java/com/getcapacitor/plugin/util/CapacitorHttpUrlConnection.java @@ -275,7 +275,7 @@ private void writeFormDataRequestBody(String contentType, JSArray entries) throw if (type.equals("string")) { os.writeBytes(twoHyphens + boundary + lineEnd); os.writeBytes("Content-Disposition: form-data; name=\"" + key + "\"" + lineEnd + lineEnd); - os.writeBytes(value); + os.write(value.getBytes(StandardCharsets.UTF_8)); os.writeBytes(lineEnd); } else if (type.equals("base64File")) { String fileName = entry.getString("fileName");