Does sendSms() support sending Chinese words?


#1

Hi all, I’d like to use the sendSms() method to send SMS in Chinese.
I’ve tried but failed to receive the Chinese SMS (My phone can receive the SMSes in English)
Is that possible? Does sendSms() / SmartThings support Chinese processing?

FYI, log.debug can successfully print the strings in Chinese.

Thanks in advance!


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

I can’t speak specifically for the sendSms() method, but I know that various SmartThings APIs do not handle Unicode properly and others do.

So if you are passing sendSms() a valid Unicode string, and you are not receiving the expected result, then it is highly likely the answer is “no”; and I would not expect this to be fixed.

You should contact Support@SmartThings.com so they can escalate this question to an informed engineer and log it as a feature request or bug fix if necessary.


(Pizzinini) #3

I can’t speak for SMS either but TTS (voice notifications) do! I use the RemindR smart app to tell my kids that it is time to go to bed in multiple languages inc Japanese. The input in the app uses Japanese characters. The voice interfaces does currently not support Chinese but if Japanese character set works in Smartthings, I think Chinese should work, too.


#4

Hi, @tgauchat Thanks! I’ve contacted the support team. I will post the feedback if I got any.


#5

Hi, @pizzinini thanks for the information.
At first, I thought it could be that the RemindR app hands the enconde/decode of Chinese/Janpanse characters.
However, as I read the source codes, it does not.
Then, I tried to use sendSms() to send Janpanese words. It failed, too.

So, I guess the situation here is that, as tgauchat said, “various SmartThings APIs do not handle Unicode properly and others do”, and that, sendSms just does not handle the Unicode properly (Not sure about this, but this is what I figured for now).


(Pizzinini) #6

Check this out… here is the thread about fixing special characters in TTS. Maybe you start the same for SMS :slight_smile:
textToSpeech with a non-default language of Polly


#7

Thanks, pizzinini.
Hi, @gausnes could you please help with this problem of “Chinese processing in sendSms() method”. Thanks!!


(Luke - Backend Engineer) #8

@Bin do you want to DM your account information? I will need to look at a StackTrace to figure out why this Chinese characters are causing issue.


#9

@gausnes the problem I met is rather simple. I am using the IDE simulator to test the SmartAPPs I write.
However, the simplest SmartAPP (codes are shown below) can send English SMS to my phone, while Chinese SMS never gets to my phone.

definition(
name: “SMS with different languages”,
namespace: “TEST”,
author: “YB”,
description: “send messages in different languages to my phone”,
category: “My Apps”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”,
iconX3Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”)

preferences {
}

def installed() {
initialize()
}

def updated() {
initialize()
}

def initialize() {
log.debug “sendMessages()”
sendMessages()
}

def sendMessages() {
def messageCHN = “1 中文消息”
def messageEN = “2 English Message”

def phone = "+86136XXXXXXXX"
//anonymization for privacy
//in my test case, I put my real phone number here and can get the English SMS

sendSms(phone, messageCHN)
log.debug messageCHN
//the log.debug can print the Chinese words correctly, but no Chinese SMS is received by my phone

sendSms(phone, messageEN)
log.debug messageEN
//the English words are printed correctly by log.debug and are received successfully by my phone
// the received English SMS is shown in the image below

}

image


#10

@gausnes Is that information enough for you to tackle the problem?
By the way, all my tests are conducted in China mainland.
Thanks!


(Luke - Backend Engineer) #11

I was able to send chinese characters to myself from na01, what shard are you using?

My Test SmartApp

    name: "Chinese SMS Test",
    namespace: "gausnes",
    author: "gausnes",
    description: "Chinese SMS Test",
    category: "Mode Magic",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/App-LightUpMyWorld.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/App-LightUpMyWorld@2x.png"
)

def installed() {
	updated()
}

def updated() {
    def phone = "320xxxxxxx"
    def chinese = "1 中文消息"
    def english = "2 English Message"
    sendSms(phone, chinese)
    sendSms(phone, english)
    log.info "sent messages"
}


#12

Hi gausnes, I have run your test smartapp (filling my own phone number), both in my own computer (in China mainland) and in my friend’s computer (in USA). The results were the same. English characters were received, Chinese words were not.

What do you mean by “na01” and “shard”?


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #13

#14

Hi @tgauchat thanks for the information :smile:

Hi @gausnes, according to tagauchat’s FAQ, I am also using na01, for the URL is “https://graph.api.smartthings.com/”. Thanks


(Luke - Backend Engineer) #15

Could you try sending messages to another phone? I’m not quite sure how to solve the issues you are seeing without being able to reproduce them. Otherwise if you private message me your account email I can take a look at our logs to see if something is going wrong with your account