0

Whenever I try to send push notifications with accent (á,é,í) through OneSignal, I get the null symbol on my phone.

1 Answers1

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