2013-02-18 83 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);