I'm trying to write a java code in which I have utf8 string which contains an emoji, I want to replace that emoji with a text. for example:
I have this text: طلبت منهم مبالغ كبيرة لإتمام دراستهم
and I want it to be like this: grinningFace طلبت منهم مبالغ كبيرة لإتمام دراستهم
I tried this:
String string = "";
try {
byte[] utf8Bytes = string.getBytes("UTF-8");
string = new String(utf8Bytes, "UTF-8");
} catch (
UnsupportedEncodingException e
) {
e.printStackTrace();
}
string=string.replaceAll("[\u1F600]", "grinningF");
//also tried "\u1F600" and "u1F600"
System.out.println(string);
but it didn't work, how to do it?