GCM and special characters

I recently changed my c2dm push aaplucation to GCM. There is a new problem. Now he gets a '?' instead of 'ö','ï', ...

My server registers the correct lines, but the application receives '?' insteads.

Do you think this might have something to do with GCM?

My code is as follows:

 public static void displayMessage(Context context, Intent intent) { Bundle extras = intent.getExtras(); if (extras != null) { String message = (String) extras.get("message"); Log.v("extras", extras.toString()); Util.generateNotification(context, message, intent); } } 

and then log:

 10-02 22:18:23.671: V/intent(29809): Bundle[{message={"name":"j?rg"}, message_id=8bb60eee-3a93-4075-b606-40495511a4da, collapse_key=do_not_collapse, from=160085429222}] 

Yours faithfully!

+4
source share
1 answer

I do not think that there is a problem in GCM. Try using UTFEncoding for your message.

 String output = new String(name.getBytes("8859_1"), "utf-8"); 
+1
source

Source: https://habr.com/ru/post/1437531/


All Articles