You are here

function sms_clickatell_unicode in SMS Framework 5

Same name and namespace in other branches
  1. 6 modules/sms_clickatell/sms_clickatell.module \sms_clickatell_unicode()

Converts a string to USC-2 encoding if neccessary.

1 call to sms_clickatell_unicode()
sms_clickatell_command in modules/sms_clickatell/sms_clickatell.module
Executes a command using the Clickatell API

File

modules/sms_clickatell/sms_clickatell.module, line 410
Adds support for sending SMS messages using the Clickatell gateway.

Code

function sms_clickatell_unicode($message) {
  if (function_exists('iconv')) {
    $latin = @iconv('UTF-8', 'ISO-8859-1', $message);
    if (strcmp($latin, $message)) {
      $arr = unpack('H*hex', @iconv('UTF-8', 'UCS-2BE', $message));
      return strtoupper($arr['hex']) . '&unicode=1';
    }
  }
  return FALSE;
}