You are here

private static function Unescaper::utf8chr in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/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 modules/providers/service_container_symfony/lib/Symfony/Component/Yaml/Unescaper.php
Unescapes a character that was found in a double-quoted string.

File

modules/providers/service_container_symfony/lib/Symfony/Component/Yaml/Unescaper.php, line 132

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);
}