You are here

private static function Unescaper::utf8chr in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/yaml/Unescaper.php \Symfony\Component\Yaml\Unescaper::utf8chr()

Get the UTF-8 character for the given code point.

Parameters

int $c The unicode code point:

Return value

string The corresponding UTF-8 character

1 call to Unescaper::utf8chr()
Unescaper::unescapeCharacter in vendor/symfony/yaml/Unescaper.php
Unescapes a character that was found in a double-quoted string.

File

vendor/symfony/yaml/Unescaper.php, line 133

Class

Unescaper
Unescaper encapsulates unescaping rules for single and double-quoted YAML strings.

Namespace

Symfony\Component\Yaml

Code

private static function utf8chr($c) {
  if (0x80 > ($c %= 0x200000)) {
    return chr($c);
  }
  if (0x800 > $c) {
    return chr(0xc0 | $c >> 6) . chr(0x80 | $c & 0x3f);
  }
  if (0x10000 > $c) {
    return chr(0xe0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3f) . chr(0x80 | $c & 0x3f);
  }
  return chr(0xf0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3f) . chr(0x80 | $c >> 6 & 0x3f) . chr(0x80 | $c & 0x3f);
}