Sign In Register

How can we help you today?

Start a new topic

Error Push Notifications Firebase - Special characters

We think we´ve found a bug in the platform, regarding firebase based push notifications on Android (we don´t know if this occurs on iOS too, we are only using firebase on android at the moment).

Firebase deletes some characters like acute accents (á é í ó ú and others), ñ, etc when we send push notifications.

We think this could be because you don´t specify to use the UTF-8 charset in your requests from GameSparks to Firebase or something similar.

To reproduce the problem, you just have to send a message through cloud code, with the following code:


msg = msg.setMessageData({"title":"notificación prueba","body":"bódy","type":"tipo"});

msg = msg.setSendViaSocket(false);

msg = msg.setSendAsPush(true);

The notification arrives without the accented characters. 

In our own events, when we send messages the native C++ side receives it correctly:

WebSocket callback: {"@class":".ScriptMessage","data":{ "contestname" : "contest_daily" , "contestid" : "59537319900bea04e91d3a33" , "rank" : 29},"extCode":"ContestClosedMessage","messageId":"5959e4c276803304f5e0b01d","notification":true,"playerId":"5959e45a2d91abaf5d16fc2a","summary":"Has quedado en la posición 29.","title":"Concurso finalizado"}

However, the Java side receives it incorrectly:

public void onMessageReceived(RemoteMessage remoteMessage) {

    Log.d(TAG, "FROM: " + remoteMessage.getFrom());

    //Check if the message contains data

    if (remoteMessage.getData().size() > 0){

        Log.d(TAG, "Message data: " + remoteMessage.getData());


    //Check if the mesage contains notification

    if (remoteMessage.getNotification() != null){

        Log.d(TAG, "Message body: " + remoteMessage.getNotification().getBody());





D/MyFirebaseMsgService(10214): Message body: Has quedado en la posicin 29.

The firebase config is totally standard, we haven´t done anything special.

Could you check this? 

Please tell me if you need any further info on this.

Thank you very much.

Hi Mahei Innovation

This is a known issue and is currently in our backlog to be fixed.
I currently do not have a estimated time for when this will be fixed.
I can update you here as soon as the fix is released



Hi! Is there any update on this?
If not, is there any kind of workaround? We will release our game soon, and spanish has many accent marks.

Best regards


Hi Mahei Innovation

I don't have an update on when this will be done.
The only work a around for this at the moment is to use SparkHttp to call the the FCM rest API and manually set the content-type to utf-8.



I am also looking forward for this, also on the external http callbacks doens't work as well, I had to do a workaround to convert them to unicode code and then convert it back inside the game

I assume this same issue would cause emoji in push notifications to appear as "?" on android? When I send the same notification using the Firebase console directly the emojis turn up fine.

Any update on this issue?

Hi all

We don't have an ETA on when this issue will be fixed yet.
We will post here as soon as we have an update for you.



Hi All

We have a work around for this problem until a fix is released.

The following function will encode the string as UTF-8.

function encode_utf8(s) {
  return unescape(encodeURIComponent(s));

So for example in Cloud code

var message = encode_utf8("Séan");

function encode_utf8(s) {
  return unescape(encodeURIComponent(s));

var msg = Spark.message("pushTest");

I hope this solution will work for you until we have UTF-8 FCM encoding built in.


Login to post a comment