2013-02-18 71 views
0

我发短信与此代码有口音发送短信

SmsManager smsManager = SmsManager.getDefault(); 
smsManager.sendTextMessage("Numerber", null, "Text to send", null, null); 

它工作得很好的英文,但如果我用西班牙语失败。经过多次尝试后,我发现如果“要发送的文本”包含像“á,é,í,ó,ú”这样的口音,则发送的消息被裁剪掉了。

当然,这些口音在西班牙语中需要以适当的方式写作,所以对此有何想法?

+0

很明显,这个问题与编码有关。你确定你使用的是UTF-8,否则你能转换成它吗? – 2013-02-18 19:03:41

+2

显然使用'sendMultipartTextMessage'而不是'sendTextMessage'会产生正确的编码支持(请参阅dupe链接) – Basic 2013-02-18 19:04:45

+0

请记住 - 发送这些重音符号需要使用unicode,因此每条消息最多只能有70个字符。有些用户不喜欢,如果他们的消息正在发送 – 2013-02-18 19:07:39

回答

1

感谢大家。是的,这是你所说的。 这里是解决方案:

ArrayList<String> arrSMS = smsManager.divideMessage("Text to send"); 
smsManager.sendMultipartTextMessage("Number", null, arrSMS, null, null);