FCM notification is not working in arabic from code but while sending the same request from postman, it works as expected. Any help will be much appreciated.
public void testSendSMS() throws IOException {
CloseableHttpClient client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost("https://fcm.googleapis.com/fcm/send");
log.info("httpPost :: " + httpPost);
String msg = "تم تقديم الطلب برمز {0} بنجاح";
JSONObject body = new JSONObject();
body.put("to", "abc");
body.put("priority", "high");
JSONObject notification = new JSONObject();
notification.put("title", URLEncoder.encode(msg, StandardCharsets.UTF_8));
notification.put("body", msg);
notification.put("sound", "default");
JSONObject data = new JSONObject();
data.put("Key-1", "JSA Data 1");
data.put("Key-2", "JSA Data 2");
body.put("notification", notification);
body.put("data", data);
StringEntity entity = new StringEntity(body.toString());
httpPost.setEntity(entity);
httpPost.setHeader("Content-type", "application/json");
httpPost.setHeader("Authorization", "key=yyy");
log.info("json :: " + json);
CloseableHttpResponse response = client.execute(httpPost);
log.info("response :: " + response);
client.close();
}