Whenever I try to send push notifications with accent (á,é,í) through OneSignal, I get the null symbol on my phone.
Asked
Active
Viewed 655 times
1 Answers
0
I fixed this issue encoding my message as UTF-8
:
String payload = "{"
+ "\"app_id\": \"" + APP_ID + "\","
+ "\"filters\": [{\"field\": \"tag\", \"key\": \"company\", \"relation\": \"=\", \"value\": \"" + companyID + "\"}],"
+ "\"data\": {\"foo\": \"bar\"},"
+ "\"contents\": {\"en\": \" " + notification + "\"}"
+ "}";
byte[] data = payload.getBytes("UTF-8");
I also set the Content-Type as application/json; charset=UTF-8
.

pzaenger
- 11,381
- 3
- 45
- 46
https://stackoverflow.com/questions/39847613/why-some-special-characters-are-not-supported-in-one-signal – Petr Jordán Jun 28 '17 at 14:17