我有一个带有Utf8_mb4_general_ci
的数据库和我的表情符号。 (的 \ ud83d \ ude3b )
iOS有效。但是,如果我将在TextView(Android)
中显示此unicode。它不起作用。你能救我吗?
这是我的JSON:
[{"user_bewerten":"","anz_com":"7","rating":"0","id":"291","titel":"\\ud83d\\ude3b","text":"\\ud83d\\ude3b","cityId":"2","city_name":"Aachen","userId":"1359280c82c7c0804c5ad3235153346dc2bdde45c7150cda88ae59f2e206d61b","created_at":"2016-06-20 10:58:02"}]
这是我的功能:
Context context = this.curContext.getApplicationContext();
CheckInternetConnectionChangeReceiver cm = new CheckInternetConnectionChangeReceiver();
if(cm.CheckInternetConnection(context))
{
boolean bErg = connectSchnacken(url);
if(bErg==true)
{
Log.d("2","2");
try {
Log.d("2","2");
dataJSON = json;
Log.d("dataJSON: ",dataJSON.toString());
if(dataJSON.length() > 0){
bLeer = false;
for(int i = 0; i < dataJSON.length(); i++){
Log.d("id: "+i, ""+i);
JSONObject c = dataJSON.getJSONObject(i);
classSchnacken thisContent = new classSchnacken();
thisContent.setId(c.getInt("id"));
String id = ""+c.getInt("id");
Log.d("id: "+i, ""+c.getInt("id"));
thisContent.setTitle(c.getString("titel"));
Log.d("Titel: "+i, c.getString("titel"));
thisContent.setText(c.getString("text"));
Log.d("Text: "+i, c.getString("text"));
thisContent.setUser(c.getString("userId"));
Log.d("userId: "+i, c.getString("userId"));
thisContent.setTime(c.getString("created_at"));
Log.d("Time: "+i, c.getString("created_at"));
thisContent.setCityName(c.getString("city_name"));
thisContent.setAnzKommentare(c.getString("anz_com"));
thisContent.setAnzBewertungen(c.getString("rating"));
String currentMail = getEmailAccount();
if(c.getString("user_bewerten").toLowerCase().contains(currentMail.toLowerCase())==true)
{
thisContent.setBewertungsStatus("1");
}
else
{
thisContent.setBewertungsStatus("0");
}
Log.d("user_bewerten: "+i, c.getString("user_bewerten"));
Log.d("user_bewerten: "+i, thisContent.getBewertungsStatus());
// ADD
dataListTemp.add(thisContent);
}
}
else
{
bLeer = true;
Log.d("leer", "leer");
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.d("Fehler: ", e.toString());
}
}
}
}
dataListSchnacken = (ArrayList<classSchnacken>) dataListTemp;
return dataListTemp;
}
PHP:
$query_exec = mysql_query($query_search) or die(mysql_error());
if (mysql_errno())
{
header("HTTP/1.1 500 Internal Server Error");
echo $query.'\n';
echo mysql_error();
}
else
{
if( $query_exec!=null)
{
while($row=mysql_fetch_assoc($query_exec))
print(json_encode($output));
}
else {echo "No Data"; }
mysql_close();
}
$ query_search是我的SQL查询。