Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Xml.php

function Xml::prepareString

Escapes a string for the use in XML documents.

Any Unicode character is allowed, excluding the surrogate blocks, FFFE, and FFFF (not even as character reference).

See also

https://www.w3.org/TR/xml/#charsets

1 call to Xml::prepareString()
JunitXmlLogger::handleFault in vendor/phpunit/phpunit/src/Logging/JUnit/JunitXmlLogger.php

File

vendor/phpunit/phpunit/src/Util/Xml/Xml.php, line 34

Class

Xml
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit

Namespace

PHPUnit\Util

Code

public static function prepareString(string $string) : string {
    return preg_replace('/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]/', '', htmlspecialchars(self::convertToUtf8($string), ENT_QUOTES));
}
RSS feed
Powered by Drupal