diff --git a/src/Utils.php b/src/Utils.php
index <HASH>..<HASH> 100644
--- a/src/Utils.php
+++ b/src/Utils.php
@@ -165,17 +165,7 @@ abstract class Utils
 	*/
 	protected static function saveXML(DOMDocument $dom)
 	{
-		return preg_replace_callback(
-			'([\\xF0-\\xF4]...)',
-			function ($m)
-			{
-				$utf8 = $m[0];
-				$cp = ((ord($utf8[0]) & 7) << 18) | ((ord($utf8[1]) & 63) << 12) | ((ord($utf8[2]) & 63) << 6) | (ord($utf8[3]) & 63);
-
-				return '&#' . $cp . ';';
-			},
-			$dom->saveXML($dom->documentElement)
-		);
+		return self::encodeUnicodeSupplementaryCharacters($dom->saveXML($dom->documentElement));
 	}
 
 	/**
Utils: deduplicated code