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;
}
doc_Drupal
2016-10-29 09:34:06
Comments
Leave a Comment

Please login to continue.