You are here

function sms_clickatell_unicode in SMS Framework 6

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

Converts a string to USC-2 encoding if neccessary.

Parameters

$message: Message string.

Return value

Converted message string or FALSE.

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 639
Clickatell gateway module for Drupal SMS Framework. Outbound+Inbound+Receipts

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;
}