From deb045264967726f01ba0dc53c5107fc279290e0 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 15 Nov 2004 00:58:36 +0000 Subject: [PATCH] Add a utf-8 to hex sequence function for debugging --- includes/normal/UtfNormalUtil.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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. -- 2.20.1