messagebird/messagebird-nodejs

Arabic language as text body

nafiln opened this issue · 1 comments

Hi there
I'm trying to send Arabic text as the SMS body but unfortunately it doesn't work
Does the library support Arabic as a body text ?
Is there any Unicode implementation has to go into sending an Arabic text

Issue is resolved but I would like to keep this as example for anyone else faces the same issue
What is required is to convert the Arabic string to Unicode ( Unicode library for node is jsesc npm i jsesc --save )

let arabicText = "أهلا و سهلا "
let arabicUnicode = jsesc(arabicText)
console.log(arabicUnicode) //'\u0623\u0647\u0644\u0627 \u0648 \u0633\u0647\u0644\u0627'

// make sure you set datacoding to unicode
const params = {
'datacoding':'unicode',
'originator': 'XxX',
'recipients': [
phoneNumber
],
'body': arabicUnicode
};
messageBird.messages.create(params)