note 124749 added to function.ord

From: Date: Mon, 24 Feb 2020 14:46:56 +0000
Subject: note 124749 added to function.ord
Groups: php.notes 
Request: Send a blank email to php-notes+get-214212@lists.php.net to get a copy of this message
this function convert UTF-8 string to RTF code string. I am using code of v0rbiz at yahoo dot com, thanks!!! function cadena_rtf($txt) { $result = null; for ($pos = 0; $pos < mb_strlen($txt); $pos++) { $char = mb_substr($txt, $pos, 1); if (!preg_match("/[A-Za-z1-9,.]/", $char)) { //unicode ord real!!! $k = mb_convert_encoding($char, 'UCS-2LE', 'UTF-8'); $k1 = ord(substr($k, 0, 1)); $k2 = ord(substr($k, 1, 1)); $ord = $k2 * 256 + $k1; if ($ord > 255) { $result .= '\uc1\u' . $ord . '*'; } elseif ($ord > 32768) { $result .= '\uc1\u' . ($ord - 65535) . '*'; } else { $result .= "\\'" . dechex($ord); } } else { $result .= $char; } } return $result; } ---- Server IP: 45.112.84.4 Probable Submitter: 185.85.3.195 (proxied: 79.154.48.176) ---- Manual Page -- http://php.net/manual/en/function.ord.php Edit -- https://master.php.net/note/edit/124749 Del: integrated -- https://master.php.net/note/delete/124749/integrated Del: useless -- https://master.php.net/note/delete/124749/useless Del: bad code -- https://master.php.net/note/delete/124749/bad+code Del: spam -- https://master.php.net/note/delete/124749/spam Del: non-english -- https://master.php.net/note/delete/124749/non-english Del: in docs -- https://master.php.net/note/delete/124749/in+docs Del: other reasons-- https://master.php.net/note/delete/124749 Reject -- https://master.php.net/note/reject/124749 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#214212) next »