You are here

protected function PhpTransliteration::lookupReplacement in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/Transliteration/PhpTransliteration.php \Drupal\Component\Transliteration\PhpTransliteration::lookupReplacement()

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.

2 calls to PhpTransliteration::lookupReplacement()
PhpTransliteration::removeDiacritics in core/lib/Drupal/Component/Transliteration/PhpTransliteration.php
Removes diacritics (accents) from certain letters.
PhpTransliteration::replace in core/lib/Drupal/Component/Transliteration/PhpTransliteration.php
Replaces a single Unicode character using the transliteration database.

File

core/lib/Drupal/Component/Transliteration/PhpTransliteration.php, line 220
Contains \Drupal\Component\Transliteration\PhpTransliteration.

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