protected function PhpTransliteration::replace in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Component/Transliteration/PhpTransliteration.php \Drupal\Component\Transliteration\PhpTransliteration::replace()
Replaces a single Unicode character using the transliteration database.
Parameters
int $code: The character code of a Unicode character.
string $langcode: The language code of the language the character is in.
string $unknown_character: The character to substitute for characters without transliterated equivalents.
Return value
string US-ASCII replacement character. If it has a mapping, it is returned; otherwise, $unknown_character is returned. The replacement can contain multiple characters.
1 call to PhpTransliteration::replace()
- PhpTransliteration::transliterate in core/
lib/ Drupal/ Component/ Transliteration/ PhpTransliteration.php - Transliterates text from Unicode to US-ASCII.
File
- core/
lib/ Drupal/ Component/ Transliteration/ PhpTransliteration.php, line 225
Class
- PhpTransliteration
- Implements transliteration without using the PECL extensions.
Namespace
Drupal\Component\TransliterationCode
protected function replace($code, $langcode, $unknown_character) {
if ($code < 0x80) {
// Already lower ASCII.
return chr($code);
}
// See if there is a language-specific override for this character.
if (!isset($this->languageOverrides[$langcode])) {
$this
->readLanguageOverrides($langcode);
}
if (isset($this->languageOverrides[$langcode][$code])) {
return $this->languageOverrides[$langcode][$code];
}
return $this
->lookupReplacement($code, $unknown_character);
}