You are here

function nexmo_unicode in Nexmo SMS Gateway 7

Converts a string to UCS-2 encoding if necessary.

1 call to nexmo_unicode()
nexmo_send in ./nexmo.module
Implements hook_send().

File

./nexmo.module, line 204
Provides NEXMO implementation methods.

Code

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