将特殊字符(i.n.中文字符)从PHP传输到android

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");

I found the problem is not caused by the php or android

actually in my input form omitted the

<meta type="utf-8">

That is careless mistake

Try set set the php header charset to UTF-8 and see if it works.

Add to the html head:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />