public static function css($string)
    {
        $string = preg_replace_callback('#[^a-zA-Z0-9]#Su', function ($matches) {
            $char = $matches[0];
            // \xHH
            if (!isset($char[1])) {
                $hex = ltrim(strtoupper(bin2hex($char)), '0');
                if (0 === strlen($hex)) {
                    $hex = '0';
                }
                // Using a two character escape can cause problems if the next character continues the escape sequence.
                // There is a solution - add a space after the CSS escape (will be ignored by the CSS parser)
                return '\\' . $hex . ' ';
            }
            // \uHHHH
            $char = iconv('UTF-8', 'UTF-16BE', $char);
            return '\\' . ltrim(strtoupper(bin2hex($char)), '0') . ' ';
        }, $string);

        return $string;
    }