在Java中使用emojis通过短信

时间:2017-12-13 21:45:14

标签: java sms emoji nexmo

我一直试图在代码中使用表情符号大约一个小时但没有成功。表情符号在控制台上成功显示,但只要我发送短信,一切都会中断,这种情况就会发生。 Emoji fails to work

现在这是我的代码,不知道该怎么做,任何帮助将不胜感激:

SmsSubmissionResult[] response = 
client.getSmsClient().submitMessage(new TextMessage(
                "REMOVED",
                "REMOVED",
                "**\ud83d\ude36** Homework Task Due (18th December 
2017)\n**\ud83d\ude3c** For English: Revise for end of term 
test\n**\ud83d\ude47** This will take approximately 1 hour.\n\n"));

1 个答案:

答案 0 :(得分:3)

您似乎是使用this constructor of TextMessage发送邮件。

TextMessage(String from, String to, String messageBody)

使用the one with is unicode flag,将其设置为true

 TextMessage(String from, String to, String messageBody, boolean unicode)