Posted By

etangle on 01/26/10


Tagged

sms utf-8 ucs-2


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

tnyari


UTF-8 to UCS-2 SMS


 / Published in: PHP
 

URL: http://www.eggheadcafe.com/community/aspnet/79/10132316/utf8-to-ucs2.aspx

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

Report this snippet  

You need to login to post a comment.