From: Brion Vibber Date: Mon, 15 Nov 2004 00:58:36 +0000 (+0000) Subject: Add a utf-8 to hex sequence function for debugging X-Git-Tag: 1.5.0alpha1~1327 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=deb045264967726f01ba0dc53c5107fc279290e0;p=lhc%2Fweb%2Fwiklou.git Add a utf-8 to hex sequence function for debugging --- diff --git a/includes/normal/UtfNormalUtil.php b/includes/normal/UtfNormalUtil.php index 53f2c361f1..06e0bb4d5f 100644 --- a/includes/normal/UtfNormalUtil.php +++ b/includes/normal/UtfNormalUtil.php @@ -68,6 +68,20 @@ function hexSequenceToUtf8( $sequence ) { return $utf; } +/** + * Take a UTF-8 string and return a space-separated series of hex + * numbers representing Unicode code points. For debugging. + * + * @param string $str + * @return string + * @access private + */ +function utf8ToHexSequence( $str ) { + return rtrim( preg_replace( '/(.)/uSe', + 'sprintf("%04x ", utf8ToCodepoint("$1"))', + $str ) ); +} + /** * Determine the Unicode codepoint of a single-character UTF-8 sequence. * Does not check for invalid input data.