Replace unsupported characters with a code of the form U123456.

@param string $name
@return string
511489
private function coerceName( $name ) {
		$coercedName = DOMUtils::coerceName( $name );
		if ( $name !== $coercedName ) {
			$this->coerced = true;
		}
		return $coercedName;
	}
1106675
protected function cleanFileName($name)
    {
        $title = Str::ascii($name);

        // Convert all dashes/underscores into separator
        $flip = $separator = '-';
        $title = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title);

        // Remove all characters that are not the separator, letters, numbers, whitespace or @.
        $title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s@]+!u', '', mb_strtolower($title));

        // Replace all separator characters and whitespace by a single separator
        $title = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $title);

        return trim($title, $separator);
    }
1040522
public static function toNameStrict( string $name )
	{
		$len = strlen($name);
		if( $len < 1 || $len > 50 )
		{
			return false;
		}

		$name = str_replace("-", "_", $name);
		if(strpos($name, "__") !== false || $name[0] === "_" || $len > 1 && $name[$len-1] === "_")
		{
			return false;
		}

		if( strpos($name, "_") !== false || ! ctype_upper($name[0]) )
		{
			$name = self::toName($name);
		}

		if( is_numeric($name[0]) || preg_match('/[^a-zA-Z0-9]/', $name ) )
		{
			return false;
		}

		return $name;
	}
498398
public static function getSizeFromName($name)
	{
		$format = strtoupper($name);
		$formats = [
			'4A0' => [4767.87, 6740.79],
			'2A0' => [3370.39, 4767.87],
			'A0' => [2383.94, 3370.39],
			'A1' => [1683.78, 2383.94],
			'A2' => [1190.55, 1683.78],
			'A3' => [841.89, 1190.55],
			'A4' => [595.28, 841.89],
			'A5' => [419.53, 595.28],
			'A6' => [297.64, 419.53],
			'A7' => [209.76, 297.64],
			'A8' => [147.40, 209.76],
			'A9' => [104.88, 147.40],
			'A10' => [73.70, 104.88],
			'B0' => [2834.65, 4008.19],
			'B1' => [2004.09, 2834.65],
			'B2' => [1417.32, 2004.09],
			'B3' => [1000.63, 1417.32],
			'B4' => [708.66, 1000.63],
			'B5' => [498.90, 708.66],
			'B6' => [354.33, 498.90],
			'B7' => [249.45, 354.33],
			'B8' => [175.75, 249.45],
			'B9' => [124.72, 175.75],
			'B10' => [87.87, 124.72],
			'C0' => [2599.37, 3676.54],
			'C1' => [1836.85, 2599.37],
			'C2' => [1298.27, 1836.85],
			'C3' => [918.43, 1298.27],
			'C4' => [649.13, 918.43],
			'C5' => [459.21, 649.13],
			'C6' => [323.15, 459.21],
			'C7' => [229.61, 323.15],
			'C8' => [161.57, 229.61],
			'C9' => [113.39, 161.57],
			'C10' => [79.37, 113.39],
			'RA0' => [2437.80, 3458.27],
			'RA1' => [1729.13, 2437.80],
			'RA2' => [1218.90, 1729.13],
			'RA3' => [864.57, 1218.90],
			'RA4' => [609.45, 864.57],
			'SRA0' => [2551.18, 3628.35],
			'SRA1' => [1814.17, 2551.18],
			'SRA2' => [1275.59, 1814.17],
			'SRA3' => [907.09, 1275.59],
			'SRA4' => [637.80, 907.09],
			'LETTER' => [612.00, 792.00],
			'LEGAL' => [612.00, 1008.00],
			'LEDGER' => [1224.00, 792.00],
			'TABLOID' => [792.00, 1224.00],
			'EXECUTIVE' => [521.86, 756.00],
			'FOLIO' => [612.00, 936.00],
			'B' => [362.83, 561.26], // 'B' format paperback size 128x198mm
			'A' => [314.65, 504.57], // 'A' format paperback size 111x178mm
			'DEMY' => [382.68, 612.28], // 'Demy' format paperback size 135x216mm
			'ROYAL' => [433.70, 663.30], // 'Royal' format paperback size 153x234mm
		];

		if (!isset($formats[$format])) {
			throw new \Mpdf\MpdfException(sprintf('Unknown page format %s', $format));
		}

		return $formats[$format];
	}
872260
public static function normalizeClassname(string $name): string
    {
        $name = self::normalizeReservedKeywords($name, 'Type');

        return ucfirst(self::camelCase($name, '{[^a-z0-9]+}i'));
    }
488232
protected function getName($name)
    {
        $name = parent::getName($name);

        // This fixes any URL encoded filename and sanitize it
        $name = strtolower(urldecode($name));

        // Replace spaces with a dash
        $name = preg_replace('!\s+!', '-', $name);

        // Remove odd characters
        return preg_replace('/[^A-Za-z0-9\-_\.]/', '', $name);
    }
389149
protected function getNamedParameterRegex($name)
    {
        if (mb_substr($name, 0, 1) == ':') {
            $name = mb_substr($name, 1);
        }

        return $this->wrapRegex($this->notInsideQuotes('\:' . preg_quote($name), false));
    }
1321455
public static function coerceName( $name ) {
		$coercedName =
			mb_encode_numericentity( mb_substr( $name, 0, 1, 'UTF-8' ),
				HTMLData::$nameStartCharConvTable, 'UTF-8', true ) .
			mb_encode_numericentity( mb_substr( $name, 1, null, 'UTF-8' ),
				HTMLData::$nameCharConvTable, 'UTF-8', true );
		$coercedName = preg_replace_callback( '/&#x([0-9A-F]*);/',
			function ( $m ) {
				return 'U' . str_pad( $m[1], 6, '0', STR_PAD_LEFT );
			},
			$coercedName );
		return $coercedName;
	}
683231
protected function sensible($name)
    {
        $name = preg_replace('`([A-Z])`', '-\1', $name);
        $name = str_replace(array('-', '_'), ' ', $name);

        return ucfirst(trim(strtolower($name)));
    }
1104908
public static function fqcn(string $name): string
    {
        $type = str_replace('[]', '', $name);

        if (class_exists($type) || interface_exists($type) && '\\' !== $type[0]) {
            return '\\' . $name;
        }

        return $name;
    }
128159
public static function fixEncoding(string $s): string
    {
        // removes xD800-xDFFF, x110000 and higher
        return \htmlspecialchars_decode(\htmlspecialchars($s, ENT_NOQUOTES | ENT_IGNORE, 'UTF-8'), ENT_NOQUOTES);
    }
13739
public function replaceName($name)
    {
        $atoms = $this->atoms();
        $numAtoms = count($atoms);

        if ($numAtoms > 0) {
            if ('' === $name) {
                array_pop($atoms);
            } else {
                $atoms[$numAtoms - 1] = $name;
            }
        } elseif ('' !== $name) {
            $atoms[] = $name;
        }

        return $this->createPath(
            $atoms,
            $this instanceof AbsolutePathInterface,
            false
        );
    }
71611
public function toAscii($removeUnsupported = true)
    {
        $str = $this->str;
        foreach ($this->getChars() as $key => $value) {
            $str = str_replace($value, $key, $str);
        }
        if ($removeUnsupported) {
            $str = preg_replace('/[^\x20-\x7E]/u', '', $str);
        }

        return $str;
    }
118969
private static function validateName(string $name) : string
  {
    if (empty($name) || preg_match("/[=,; \t\r\n\013\014]/", $name)) {
      throw new \InvalidArgumentException(sprintf('Invalid name \'%s\'.', $name));
    }

    return $name;
  }
197509
final public function quoteName(string $name): string
    {
        if (! $this->handle) {
            throw new FailureException('Not connected');
        }

        return $this->handle->quoteName($name);
    }
1211477
public static function convertName($name)
    {
        if (0 === strpos($name, '@') && false !== strpos($name, '/')) {
            $name = ltrim(str_replace('/', '--', $name), '@');
        }

        return $name;
    }
81088
private static function validateReleaseFormatForHyphen($name)
    {
        if (!stristr($name, '-')) {
            throw new \Exception('Release must include a hyphen');
        }

        if (strpos($name, '-') === 0) {
            throw new \Exception('Hyphen cannot be first character');
        }

        if (strpos($name, '-') === (strlen($name) - 1)) {
            throw new \Exception('Hyphen cannot be last character');
        }
    }