This is how I send the text message to android GCM , first I encode the chinese character in PHP
$message = array("msg" => urlencode($msg));
$url = 'https://android.googleapis.com/gcm/send';
$fields = array(
'registration_ids' => $registrationIDs,
'data' => array( "message" => $message ),
);
$headers = array(
'Authorization: key=' . $api_key,
'Content-Type: application/json;');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $fields ) );
$result = curl_exec($ch);
curl_close($ch);
when the message send to android side , the symobal , digit number and english are remain normal , however, the chinese character is not, how to fix it ? thanks
msg = URLDecoder.decode(intent.getStringExtra("message"), "UTF-8");