This is my server side code or android side code. This code is working fine only for English messages. If I use Unicode charters like use Arabic language then it shows nothi
André Oriani has the general idea for the fix. Even though the message is placed in the body of the request, it still needs to url encoded.
string postData = string.Format("registration_id={0}&data.payload={1}&collapse_key={2}", id, msg, collaspeKey);
should be replaced with
string postData = string.Format("registration_id={0}&data.payload={1}&collapse_key={2}", id, HttpUtility.UrlEncode(msg), HttpUtility.UrlEncode(collaspeKey));
You will need to add a reference to System.Web in order to use HttpUtility. See URL Encoding using C# for more information.
Have you considered using base64 to encode the string sent through GCM? This way you would remove all encoding problems.
Here's what solved it for me in Java:
On the server side:
encodedMessage = URLEncoder.encode(message, "UTF-8");
In the app:
decodedMessage = URLDecoder.decode(message, "UTF-8");