W3cubDocs

/Drupal 8

protected function PhpTransliteration::lookupReplacement

protected PhpTransliteration::lookupReplacement($code, $unknown_character = '?')

Look up the generic replacement for a UTF-8 character code.

Parameters

$code: The UTF-8 character code.

string $unknown_character: (optional) The character to substitute for characters without entries in the replacement tables.

Return value

string US-ASCII replacement characters. If it has a mapping, it is returned; otherwise, $unknown_character is returned. The replacement can contain multiple characters.

File

core/lib/Drupal/Component/Transliteration/PhpTransliteration.php, line 215

Class

PhpTransliteration
Implements transliteration without using the PECL extensions.

Namespace

Drupal\Component\Transliteration

Code

protected function lookupReplacement($code, $unknown_character = '?') {
  // See if there is a generic mapping for this character.
  $bank = $code >> 8;
  if (!isset($this->genericMap[$bank])) {
    $this->readGenericData($bank);
  }
  $code = $code & 0xff;
  return isset($this->genericMap[$bank][$code]) ? $this->genericMap[$bank][$code] : $unknown_character;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Transliteration!PhpTransliteration.php/function/PhpTransliteration::lookupReplacement/8.1.x