Search code examples
javaandroidblackberrysmssms-gateway

How to send SMS with HTML tags?


I am sending an sms from my java web application to Android and BB end user. This message has some HTML tags like anchor tag, bold tag etc. The same is getting displayed in the mobile end. Is it something I have to do encode or should it be done in mobile's end? I am new to this SMS implemenation. Can someone pls help me?

Thanks in advance.


Solution

  • I guess you want to encode from your application and not in the mobile end ?

    Then encode the html. I would suggest the best html encoder is StringEscapeUtils

    StringEscapeUtils.escapeHtml(htmlString)
    

    And if you want to do it from the mobile end then use Html.fromHtml (String source)